<complex_conditional>: agrega metodo not_legendary? a GildedRose

This commit is contained in:
Felipe Gaete 2024-08-18 23:25:16 -04:00
parent c5f4394a09
commit 2a5586422c

View File

@ -4,11 +4,15 @@ class GildedRose
@items = items
end
def not_legendary?(item)
item.name != "Sulfuras, Hand of Ragnaros"
end
def update_quality()
@items.each do |item|
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
if item.quality > 0
if item.name != "Sulfuras, Hand of Ragnaros"
if not_legendary?(item)
item.quality = item.quality - 1
end
end
@ -29,14 +33,14 @@ class GildedRose
end
end
end
if item.name != "Sulfuras, Hand of Ragnaros"
if not_legendary?(item)
item.sell_in = item.sell_in - 1
end
if item.sell_in < 0
if item.name != "Aged Brie"
if item.name != "Backstage passes to a TAFKAL80ETC concert"
if item.quality > 0
if item.name != "Sulfuras, Hand of Ragnaros"
if not_legendary?(item)
item.quality = item.quality - 1
end
end