mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-10 04:01:19 +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
|
@items = items
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def not_legendary?(item)
|
||||||
|
item.name != "Sulfuras, Hand of Ragnaros"
|
||||||
|
end
|
||||||
|
|
||||||
def update_quality()
|
def update_quality()
|
||||||
@items.each do |item|
|
@items.each do |item|
|
||||||
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
|
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
|
||||||
if item.quality > 0
|
if item.quality > 0
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros"
|
if not_legendary?(item)
|
||||||
item.quality = item.quality - 1
|
item.quality = item.quality - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -29,14 +33,14 @@ class GildedRose
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros"
|
if not_legendary?(item)
|
||||||
item.sell_in = item.sell_in - 1
|
item.sell_in = item.sell_in - 1
|
||||||
end
|
end
|
||||||
if item.sell_in < 0
|
if item.sell_in < 0
|
||||||
if item.name != "Aged Brie"
|
if item.name != "Aged Brie"
|
||||||
if item.name != "Backstage passes to a TAFKAL80ETC concert"
|
if item.name != "Backstage passes to a TAFKAL80ETC concert"
|
||||||
if item.quality > 0
|
if item.quality > 0
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros"
|
if not_legendary?(item)
|
||||||
item.quality = item.quality - 1
|
item.quality = item.quality - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user