module Manufacturable::Item

Public Class Methods

extended(base) click to toggle source
# File lib/manufacturable/item.rb, line 25
def self.extended(base)
  base.include(InstanceMethods)
end

Public Instance Methods

corresponds_to(key, type = self.superclass) click to toggle source
# File lib/manufacturable/item.rb, line 12
def corresponds_to(key, type = self.superclass)
  key = key == type ? Registrar::ALL_KEY : key
  Registrar.register(type, key, self)
end
corresponds_to_all(type = self.superclass) click to toggle source
# File lib/manufacturable/item.rb, line 17
def corresponds_to_all(type = self.superclass)
  corresponds_to(Registrar::ALL_KEY, type)
end
default_manufacturable(type = self.superclass) click to toggle source
# File lib/manufacturable/item.rb, line 21
def default_manufacturable(type = self.superclass)
  corresponds_to(Registrar::DEFAULT_KEY, type)
end
new(*args, **kwargs, &block) click to toggle source
Calls superclass method
# File lib/manufacturable/item.rb, line 5
def new(*args, **kwargs, &block)
  key = kwargs.delete(:manufacturable_item_key)
  instance = kwargs.empty? ? super(*args, &block) : super
  instance.instance_variable_set(:@manufacturable_item_key, key)
  instance
end