From 5f137d63120769d8822c05afc79e6253f94de46f Mon Sep 17 00:00:00 2001 From: davidraj Date: Mon, 10 Oct 2022 18:58:30 +0100 Subject: [PATCH] composed method - old item --- ruby/item_processor.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ruby/item_processor.rb b/ruby/item_processor.rb index 37ad0e5b..4e45cd9a 100644 --- a/ruby/item_processor.rb +++ b/ruby/item_processor.rb @@ -19,7 +19,7 @@ class ItemProcessor end end end - item.sell_in = item.sell_in - 1 if item.name != 'Sulfuras, Hand of Ragnaros' + old_item if item.sell_in < 0 if item.name != 'Aged Brie' if item.name != 'Backstage passes to a TAFKAL80ETC concert' @@ -40,4 +40,8 @@ class ItemProcessor def decrease_item_quality item.quality -= 1 if item.quality > 0 && item.name != 'Sulfuras, Hand of Ragnaros' end + + def old_item + item.sell_in = item.sell_in - 1 if item.name != 'Sulfuras, Hand of Ragnaros' + end end