entelo/industrialist

View on GitHub
lib/industrialist/manufacturable.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'industrialist/registrar'
require 'industrialist/type'

module Industrialist
  module Manufacturable
    def self.extended(base)
      base.class_variable_set(:@@type, Type.industrialize(base))
    end

    def corresponds_to(key)
      Registrar.register(self.class_variable_get(:@@type), key, self)
    end

    def manufacturable_default
      Registrar.register_default(self.class_variable_get(:@@type), self)
    end
  end
end