Move ItemFactory to a separate file

This commit is contained in:
Feken Baboyan 2021-02-25 14:51:18 -05:00
parent fc8eae7652
commit 7767e6a6f6

10
ruby/item_factory.rb Normal file
View 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