Module: Swiftly::Smokestack
- Defined in:
- lib/swiftly/smokestack.rb
Class Method Summary collapse
Class Method Details
.build(factory_class, overrides = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/swiftly/smokestack.rb', line 21 def self.build(factory_class, overrides = {}) instance = Swiftly.const_get(factory_class.capitalize).new factory = registry[Swiftly.const_get(factory_class.capitalize)] attributes = factory.attributes.merge(overrides) attributes.each do |attribute_name, value| instance.send("#{attribute_name}=", value) end instance end |
.define(&block) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/swiftly/smokestack.rb', line 14 def self.define(&block) definition_proxy = Swiftly::DefinitionProxy.new definition_proxy.instance_eval(&block) end |
.registry ⇒ Object
8 9 10 11 12 |
# File 'lib/swiftly/smokestack.rb', line 8 def self.registry @registry end |