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