Permalink
Browse files

Add update method to BaseUpdater... one method to rule them all ;)

  • Loading branch information...
francho committed Jun 10, 2016
1 parent 4355372 commit 3d80eb0e4336303eb106be62fc2849fbd22385cc
Showing with 8 additions and 4 deletions.
  1. +1 −2 gilded_rose.rb
  2. +7 −2 lib/base_updater.rb
View
@@ -3,8 +3,7 @@
def update_quality(items)
items.each do |item|
updater = ItemUpdater.for item
updater.update_sell_in
updater.update_quality
updater.update
end
end
View
@@ -3,6 +3,13 @@ def initialize(item)
@item = item
end
def update
update_sell_in
update_quality
end
protected
def update_quality
decrease_quality_by_one
decrease_quality_by_one if @item.sell_in < 0
@@ -12,8 +19,6 @@ def update_sell_in
@item.sell_in -= 1
end
protected
def decrease_quality_by_one
return unless @item.quality > 0
@item.quality -= 1

0 comments on commit 3d80eb0

Please sign in to comment.