Class: Morfo::Actions::Field
- Inherits:
-
Object
- Object
- Morfo::Actions::Field
- Defined in:
- lib/morfo/actions.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#field_path ⇒ Object
readonly
Returns the value of attribute field_path.
Instance Method Summary collapse
- #calculated(&calculate_blk) ⇒ Object
- #execute(row) ⇒ Object
- #from(*from_field_path) ⇒ Object
-
#initialize(field_path, actions) ⇒ Field
constructor
A new instance of Field.
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
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
5 6 7 |
# File 'lib/morfo/actions.rb', line 5 def actions @actions end |
#field_path ⇒ Object (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 ArgumentError, "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 |