mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 06:21:29 +00:00
Move ItemFactory to a separate file
This commit is contained in:
parent
fc8eae7652
commit
7767e6a6f6
10
ruby/item_factory.rb
Normal file
10
ruby/item_factory.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class ItemFactory
|
||||
SPECIAL_ITEMS = ["Aged Brie", "Backstage passes to a TAFKAL80ETC concert", "Sulfuras, Hand of Ragnaros"]
|
||||
def self.create_item(name:, sell_in:, quality:)
|
||||
if SPECIAL_ITEMS.include?(name)
|
||||
return Item.new(name, sell_in, quality)
|
||||
end
|
||||
|
||||
GenericItem.new(name, sell_in, quality)
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user