Class: ArrayFu::MutatorDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/arrayfu/mutator_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#blockObject (readonly)

Returns the value of attribute block.



4
5
6
# File 'lib/arrayfu/mutator_definition.rb', line 4

def block
  @block
end

#nameObject (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