mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-10 12:11:20 +00:00
<duplicate_code> agrega metodo para decrementar calidad de item
This commit is contained in:
parent
2a5586422c
commit
640daa2382
@ -8,12 +8,16 @@ class GildedRose
|
|||||||
item.name != "Sulfuras, Hand of Ragnaros"
|
item.name != "Sulfuras, Hand of Ragnaros"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def decrease_quality(item)
|
||||||
|
item.quality = item.quality - 1
|
||||||
|
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 not_legendary?(item)
|
if not_legendary?(item)
|
||||||
item.quality = item.quality - 1
|
decrease_quality(item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -41,7 +45,7 @@ class GildedRose
|
|||||||
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 not_legendary?(item)
|
if not_legendary?(item)
|
||||||
item.quality = item.quality - 1
|
decrease_quality(item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user