From d04634f03a97df98d954f763827f00fb4ffe8f3d Mon Sep 17 00:00:00 2001 From: degwinthegreat Date: Fri, 14 May 2021 20:43:42 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=83=E3=83=97=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=82=AF=E3=82=AA=E3=83=AA=E3=83=86=E3=82=A3=E3=81=AE?= =?UTF-8?q?=E3=83=8D=E3=82=B9=E3=83=88=E3=82=92=E6=B5=85=E3=81=8F=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=80=81return=E3=82=92next=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruby/gilded_rose.rb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ruby/gilded_rose.rb b/ruby/gilded_rose.rb index 3cb9d2ee..97acd939 100644 --- a/ruby/gilded_rose.rb +++ b/ruby/gilded_rose.rb @@ -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