mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
アップデートクオリティのネストを浅くして、returnをnextに変更
This commit is contained in:
parent
3fe730ddc4
commit
d04634f03a
@ -36,21 +36,19 @@ class GildedRose
|
|||||||
|
|
||||||
def update_quality()
|
def update_quality()
|
||||||
@items.each do |item|
|
@items.each do |item|
|
||||||
return if item.name == SULFURAS
|
next if item.name == SULFURAS
|
||||||
|
|
||||||
first_step(item)
|
first_step(item)
|
||||||
item.sell_in = item.sell_in - 1
|
item.sell_in = item.sell_in - 1
|
||||||
if item.sell_in < 0
|
next if item.sell_in >= 0
|
||||||
if item.name == AGED_BRIE
|
case item.name
|
||||||
increment_item_quality(item)
|
when AGED_BRIE
|
||||||
else
|
increment_item_quality(item)
|
||||||
if item.name == BACKSTAGE_PASS
|
when BACKSTAGE_PASS
|
||||||
item.quality = 0
|
item.quality = 0
|
||||||
else
|
else
|
||||||
if item.quality > 0
|
if item.quality > 0
|
||||||
item.quality = item.quality - 1
|
item.quality = item.quality - 1
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user