Module: Manufactory::ManufactoryMixin
- Includes:
- Blueprints
- Included in:
- DataMapperExtensions, GenericModelMixin, ObjectMixin
- Defined in:
- lib/manufactory.rb
Instance Method Summary collapse
Methods included from Blueprints
Instance Method Details
#make(adapter, name = :default, attributes = Hash.new, &block) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/manufactory.rb', line 27 def make(adapter, name = :default, attributes = Hash.new, &block) name, attributes = :default, name if name.is_a?(Hash) && attributes.empty? callables = self.blueprints[name] adapter = adapter.new(self, name, callables) instance = adapter.run(attributes) instance.instance_eval(&block) if block_given? return instance end |