Class: Inject::Injector
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
5 6 7 |
# File 'lib/attr_inject/injector.rb', line 5 def parent @parent end |
Instance Method Details
#apply(target) ⇒ Object
16 17 18 19 |
# File 'lib/attr_inject/injector.rb', line 16 def apply(target) hash = parent ? parent.merge(self) : self target.inject_attributes hash end |
#factory(key, &block) ⇒ Object
11 12 13 14 |
# File 'lib/attr_inject/injector.rb', line 11 def factory(key, &block) raise ArgumentError, "Block is required for factories." if block.nil? self[key] = block end |
#map(key, val) ⇒ Object
7 8 9 |
# File 'lib/attr_inject/injector.rb', line 7 def map(key, val) self[key] = val end |