class Stockman::Logic::SellableFactory

Constants

VALID_SELLABLE_TYPES

Public Class Methods

build_sellable(sellable_data) click to toggle source
# 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