mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Introduce ItemFactory in GildedRose::Store class
This commit is contained in:
parent
dc9e8be57d
commit
f196a3ab9b
@ -1,12 +1,12 @@
|
||||
module GildedRose
|
||||
class Store
|
||||
|
||||
def initialize(items)
|
||||
@items = items
|
||||
def initialize(raw_items)
|
||||
@raw_items = raw_items
|
||||
end
|
||||
|
||||
def update_quality()
|
||||
@items.each do |item|
|
||||
items.each do |item|
|
||||
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
|
||||
if item.quality > 0
|
||||
if item.name != "Sulfuras, Hand of Ragnaros"
|
||||
@ -52,6 +52,12 @@ module GildedRose
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def items
|
||||
@items ||= @raw_items.map do |item|
|
||||
ItemFactory.create_item(name: item.name, sell_in: item.sell_in, quality: item.quality)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Item
|
||||
|
||||
Loading…
Reference in New Issue
Block a user