mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 17:21:38 +00:00
<complex_conditional>: agrega metodo not_legendary? a GildedRose
This commit is contained in:
parent
c5f4394a09
commit
2a5586422c
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user