diff --git a/ruby/gilded_rose.rb b/ruby/gilded_rose.rb index e6bc3c4b..66102019 100644 --- a/ruby/gilded_rose.rb +++ b/ruby/gilded_rose.rb @@ -8,12 +8,16 @@ class GildedRose item.name != "Sulfuras, Hand of Ragnaros" end + def decrease_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" if item.quality > 0 if not_legendary?(item) - item.quality = item.quality - 1 + decrease_quality(item) end end else @@ -41,7 +45,7 @@ class GildedRose if item.name != "Backstage passes to a TAFKAL80ETC concert" if item.quality > 0 if not_legendary?(item) - item.quality = item.quality - 1 + decrease_quality(item) end end else