Class: Stockman::Logic::SellableFactory
- Inherits:
-
Object
- Object
- Stockman::Logic::SellableFactory
- Defined in:
- lib/stockman/logic/sellable_factory.rb
Constant Summary collapse
- VALID_SELLABLE_TYPES =
['variants', 'kits']
Class Method Summary collapse
Class Method Details
.build_sellable(sellable_data) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/stockman/logic/sellable_factory.rb', line 6 def self.build_sellable(sellable_data) type, id = *sellable_data.split(":") raise "#{type} is not valid sellable type" unless VALID_SELLABLE_TYPES.include?(type) "Stockman::Logic::#{type.singularize.classify}".constantize.new(id.to_i) end |