mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-05 01:32:14 +00:00
<duplicate code> agrega metodo para incrementar calidad de item
This commit is contained in:
parent
640daa2382
commit
a55474f928
@ -12,6 +12,10 @@ class GildedRose
|
||||
item.quality = item.quality - 1
|
||||
end
|
||||
|
||||
def increase_quality(item)
|
||||
item.quality = item.quality + 1
|
||||
end
|
||||
|
||||
def update_quality()
|
||||
@items.each do |item|
|
||||
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
|
||||
@ -22,16 +26,16 @@ class GildedRose
|
||||
end
|
||||
else
|
||||
if item.quality < 50
|
||||
item.quality = item.quality + 1
|
||||
increase_quality(item)
|
||||
if item.name == "Backstage passes to a TAFKAL80ETC concert"
|
||||
if item.sell_in < 11
|
||||
if item.quality < 50
|
||||
item.quality = item.quality + 1
|
||||
increase_quality(item)
|
||||
end
|
||||
end
|
||||
if item.sell_in < 6
|
||||
if item.quality < 50
|
||||
item.quality = item.quality + 1
|
||||
increase_quality(item)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -53,7 +57,7 @@ class GildedRose
|
||||
end
|
||||
else
|
||||
if item.quality < 50
|
||||
item.quality = item.quality + 1
|
||||
increase_quality(item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user