mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
composing into smaller methods
This commit is contained in:
parent
ae84163e48
commit
56370b0f89
@ -16,12 +16,8 @@ class ItemProcessor
|
||||
if item.quality < 50
|
||||
item.quality += 1
|
||||
if item.name == 'Backstage passes to a TAFKAL80ETC concert'
|
||||
if item.sell_in < 11
|
||||
item.quality += 1 if item.quality < 50
|
||||
end
|
||||
if item.sell_in < 6
|
||||
item.quality += 1 if item.quality < 50
|
||||
end
|
||||
increase_item_quality if item.sell_in < 11
|
||||
increase_item_quality if item.sell_in < 6
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -36,8 +32,12 @@ class ItemProcessor
|
||||
item.quality = item.quality - item.quality
|
||||
end
|
||||
else
|
||||
item.quality += 1 if item.quality < 50
|
||||
increase_item_quality
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def increase_item_quality
|
||||
item.quality += 1 if item.quality < 50
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user