Class: ArrayFu::MutatorDefinition
- Inherits:
-
Object
- Object
- ArrayFu::MutatorDefinition
- Defined in:
- lib/arrayfu/mutator_definition.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, block) ⇒ MutatorDefinition
constructor
A new instance of MutatorDefinition.
- #run(target, value) ⇒ Object
Constructor Details
#initialize(name, block) ⇒ MutatorDefinition
Returns a new instance of MutatorDefinition.
6 7 8 9 |
# File 'lib/arrayfu/mutator_definition.rb', line 6 def initialize(name, block) @name = name @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
4 5 6 |
# File 'lib/arrayfu/mutator_definition.rb', line 4 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/arrayfu/mutator_definition.rb', line 3 def name @name end |
Instance Method Details
#run(target, value) ⇒ Object
11 12 13 |
# File 'lib/arrayfu/mutator_definition.rb', line 11 def run(target, value) target.instance_exec value, &block end |