Class: Morfo::MapAction
- Inherits:
-
Object
- Object
- Morfo::MapAction
- Defined in:
- lib/morfo.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#transformation ⇒ Object
readonly
Returns the value of attribute transformation.
Instance Method Summary collapse
- #execute(row) ⇒ Object
-
#initialize(from, to, transformation) ⇒ MapAction
constructor
A new instance of MapAction.
Constructor Details
#initialize(from, to, transformation) ⇒ MapAction
Returns a new instance of MapAction.
40 41 42 43 44 |
# File 'lib/morfo.rb', line 40 def initialize from, to, transformation @from = from @to = to @transformation = transformation end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
36 37 38 |
# File 'lib/morfo.rb', line 36 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
37 38 39 |
# File 'lib/morfo.rb', line 37 def to @to end |
#transformation ⇒ Object (readonly)
Returns the value of attribute transformation.
38 39 40 |
# File 'lib/morfo.rb', line 38 def transformation @transformation end |
Instance Method Details
#execute(row) ⇒ Object
46 47 48 49 |
# File 'lib/morfo.rb', line 46 def execute row resulting_value = apply_transformation(extract_value(row)) resulting_value ? store_value(to, resulting_value) : {} end |