mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +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
|
def update_item_quality
|
||||||
if (item.name != 'Aged Brie') && (item.name != 'Backstage passes to a TAFKAL80ETC concert')
|
if (item.name != 'Aged Brie') && (item.name != 'Backstage passes to a TAFKAL80ETC concert')
|
||||||
if item.quality > 0
|
decrease_item_quality
|
||||||
item.quality -= 1 if item.name != 'Sulfuras, Hand of Ragnaros'
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if item.quality < 50
|
if item.quality < 50
|
||||||
item.quality += 1
|
item.quality += 1
|
||||||
@ -25,9 +23,7 @@ class ItemProcessor
|
|||||||
if item.sell_in < 0
|
if item.sell_in < 0
|
||||||
if item.name != 'Aged Brie'
|
if item.name != 'Aged Brie'
|
||||||
if item.name != 'Backstage passes to a TAFKAL80ETC concert'
|
if item.name != 'Backstage passes to a TAFKAL80ETC concert'
|
||||||
if item.quality > 0
|
decrease_item_quality
|
||||||
item.quality -= 1 if item.name != 'Sulfuras, Hand of Ragnaros'
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
item.quality = item.quality - item.quality
|
item.quality = item.quality - item.quality
|
||||||
end
|
end
|
||||||
@ -40,4 +36,8 @@ class ItemProcessor
|
|||||||
def increase_item_quality
|
def increase_item_quality
|
||||||
item.quality += 1 if item.quality < 50
|
item.quality += 1 if item.quality < 50
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def decrease_item_quality
|
||||||
|
item.quality -= 1 if item.quality > 0 && item.name != 'Sulfuras, Hand of Ragnaros'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user