mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-10 20:21:26 +00:00
<duplicate code> agregar metodo para aged brie
This commit is contained in:
parent
013f3aa57b
commit
89997aa956
@ -20,9 +20,13 @@ class GildedRose
|
|||||||
item.quality = item.quality + 1
|
item.quality = item.quality + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def aged_brie?(item)
|
||||||
|
item.name == "Aged Brie"
|
||||||
|
end
|
||||||
|
|
||||||
def update_quality()
|
def update_quality()
|
||||||
@items.each do |item|
|
@items.each do |item|
|
||||||
if item.name != "Aged Brie" and !backstage_pass?(item)
|
if !aged_brie?(item) and !backstage_pass?(item)
|
||||||
if item.quality > 0
|
if item.quality > 0
|
||||||
if not_legendary?(item)
|
if not_legendary?(item)
|
||||||
decrease_quality(item)
|
decrease_quality(item)
|
||||||
@ -45,7 +49,7 @@ class GildedRose
|
|||||||
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 !aged_brie?(item)
|
||||||
if !backstage_pass?(item)
|
if !backstage_pass?(item)
|
||||||
if item.quality > 0
|
if item.quality > 0
|
||||||
if not_legendary?(item)
|
if not_legendary?(item)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user