アップデートクオリティのネストを浅くして、returnをnextに変更

This commit is contained in:
degwinthegreat 2021-05-14 20:43:42 +09:00
parent 3fe730ddc4
commit d04634f03a

View File

@ -36,15 +36,15 @@ 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
when AGED_BRIE
increment_item_quality(item) increment_item_quality(item)
else when BACKSTAGE_PASS
if item.name == BACKSTAGE_PASS
item.quality = 0 item.quality = 0
else else
if item.quality > 0 if item.quality > 0
@ -54,8 +54,6 @@ class GildedRose
end end
end end
end end
end
end
class Item class Item
attr_accessor :name, :sell_in, :quality attr_accessor :name, :sell_in, :quality