Permalink
Browse files

Extract backstage? method

  • Loading branch information...
francho committed Jun 10, 2016
1 parent 6be0471 commit 7d0113604bef383933b4d733cf49792833c7893f
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/item_updater.rb
View
@@ -1,6 +1,6 @@
class ItemUpdater
def self.update(item)
if !aged_brie?(item) && item.name != 'Backstage passes to a TAFKAL80ETC concert'
if !aged_brie?(item) && !backstage?(item)
if item.quality > 0
if item.name != 'Sulfuras, Hand of Ragnaros'
item.quality -= 1
@@ -9,7 +9,7 @@ def self.update(item)
else
if item.quality < 50
item.quality += 1
if item.name == 'Backstage passes to a TAFKAL80ETC concert'
if backstage?(item)
if item.sell_in < 11
if item.quality < 50
item.quality += 1
@@ -28,7 +28,7 @@ def self.update(item)
end
if item.sell_in < 0
unless aged_brie?item
if item.name != 'Backstage passes to a TAFKAL80ETC concert'
unless backstage?(item)
if item.quality > 0
if item.name != 'Sulfuras, Hand of Ragnaros'
item.quality -= 1
@@ -49,4 +49,8 @@ def self.update(item)
def self.aged_brie?(item)
item.name.eql? 'Aged Brie'
end
def self.backstage?(item)
item.name.eql? 'Backstage passes to a TAFKAL80ETC concert'
end
end

0 comments on commit 7d01136

Please sign in to comment.