mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +00:00
16 lines
427 B
Python
16 lines
427 B
Python
from python.item import AgedBrie, Sulfuras, Backstage, Conjured, RegularItem
|
|
|
|
item_to_class_map = {
|
|
"Aged Brie": AgedBrie,
|
|
"Sulfuras, Hand of Ragnaros": Sulfuras,
|
|
"Backstage passes to a TAFKAL80ETC concert": Backstage,
|
|
"Conjured": Conjured
|
|
}
|
|
|
|
|
|
class FactoryItem:
|
|
|
|
@staticmethod
|
|
def create_new_item(name, sell_in, quality):
|
|
return item_to_class_map.get(name, RegularItem)(name, sell_in, quality)
|