mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
composing to smaller methods for decrease in quality
This commit is contained in:
parent
56370b0f89
commit
8a5ad5ca19
@ -9,9 +9,7 @@ class ItemProcessor
|
||||
|
||||
def update_item_quality
|
||||
if (item.name != 'Aged Brie') && (item.name != 'Backstage passes to a TAFKAL80ETC concert')
|
||||
if item.quality > 0
|
||||
item.quality -= 1 if item.name != 'Sulfuras, Hand of Ragnaros'
|
||||
end
|
||||
decrease_item_quality
|
||||
else
|
||||
if item.quality < 50
|
||||
item.quality += 1
|
||||
@ -25,9 +23,7 @@ class ItemProcessor
|
||||
if item.sell_in < 0
|
||||
if item.name != 'Aged Brie'
|
||||
if item.name != 'Backstage passes to a TAFKAL80ETC concert'
|
||||
if item.quality > 0
|
||||
item.quality -= 1 if item.name != 'Sulfuras, Hand of Ragnaros'
|
||||
end
|
||||
decrease_item_quality
|
||||
else
|
||||
item.quality = item.quality - item.quality
|
||||
end
|
||||
@ -40,4 +36,8 @@ class ItemProcessor
|
||||
def increase_item_quality
|
||||
item.quality += 1 if item.quality < 50
|
||||
end
|
||||
|
||||
def decrease_item_quality
|
||||
item.quality -= 1 if item.quality > 0 && item.name != 'Sulfuras, Hand of Ragnaros'
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user