Permalink
Browse files

Extract aged_brie? method

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

0 comments on commit 6be0471

Please sign in to comment.