Skip to content

Commit

Permalink
Extract sulfuras? method
Browse files Browse the repository at this point in the history
  • Loading branch information
francho committed Jun 10, 2016
1 parent 7d01136 commit 56b524d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/item_updater.rb
Expand Up @@ -2,7 +2,7 @@ class ItemUpdater
def self.update(item)
if !aged_brie?(item) && !backstage?(item)
if item.quality > 0
if item.name != 'Sulfuras, Hand of Ragnaros'
unless sulfuras?(item)
item.quality -= 1
end
end
Expand All @@ -23,14 +23,14 @@ def self.update(item)
end
end
end
if item.name != 'Sulfuras, Hand of Ragnaros'
unless sulfuras?(item)
item.sell_in -= 1
end
if item.sell_in < 0
unless aged_brie?item
unless backstage?(item)
if item.quality > 0
if item.name != 'Sulfuras, Hand of Ragnaros'
unless sulfuras?(item)
item.quality -= 1
end
end
Expand All @@ -53,4 +53,8 @@ def self.aged_brie?(item)
def self.backstage?(item)
item.name.eql? 'Backstage passes to a TAFKAL80ETC concert'
end

def self.sulfuras?(item)
item.name.eql? 'Sulfuras, Hand of Ragnaros'
end
end

0 comments on commit 56b524d

Please sign in to comment.