Class: Morfo::Actions::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/morfo/actions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field_path, actions) ⇒ Field

Returns a new instance of Field.



7
8
9
10
# File 'lib/morfo/actions.rb', line 7

def initialize field_path, actions
  @field_path = field_path
  @actions = actions
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



5
6
7
# File 'lib/morfo/actions.rb', line 5

def actions
  @actions
end

#field_pathObject (readonly)

Returns the value of attribute field_path.



4
5
6
# File 'lib/morfo/actions.rb', line 4

def field_path
  @field_path
end

Instance Method Details

#calculated(&calculate_blk) ⇒ Object



18
19
20
21
22
# File 'lib/morfo/actions.rb', line 18

def calculated &calculate_blk
  act = CalculationAction.new self, field_path, calculate_blk
  actions[field_path] = act
  act
end

#execute(row) ⇒ Object



24
25
26
27
# File 'lib/morfo/actions.rb', line 24

def execute row
  raise Morfo::NoSourceFieldError,
    "No field to get value from is specified for #{field_path.inspect}"
end

#from(*from_field_path) ⇒ Object



12
13
14
15
16
# File 'lib/morfo/actions.rb', line 12

def from *from_field_path
  act = FromAction.new self, from_field_path
  actions[field_path] = act
  act
end