Class: Morfo::MapAction

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fromObject (readonly)

Returns the value of attribute from.



36
37
38
# File 'lib/morfo.rb', line 36

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



37
38
39
# File 'lib/morfo.rb', line 37

def to
  @to
end

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