mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +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
|
if item.quality < 50
|
||||||
item.quality += 1
|
item.quality += 1
|
||||||
if item.name == 'Backstage passes to a TAFKAL80ETC concert'
|
if item.name == 'Backstage passes to a TAFKAL80ETC concert'
|
||||||
if item.sell_in < 11
|
increase_item_quality if item.sell_in < 11
|
||||||
item.quality += 1 if item.quality < 50
|
increase_item_quality if item.sell_in < 6
|
||||||
end
|
|
||||||
if item.sell_in < 6
|
|
||||||
item.quality += 1 if item.quality < 50
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -36,8 +32,12 @@ class ItemProcessor
|
|||||||
item.quality = item.quality - item.quality
|
item.quality = item.quality - item.quality
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
item.quality += 1 if item.quality < 50
|
increase_item_quality
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def increase_item_quality
|
||||||
|
item.quality += 1 if item.quality < 50
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user