class Morfo::Actions::FromAction

Attributes

field[R]
from_field_path[R]

Public Class Methods

new(field, from_field_path) click to toggle source
# File lib/morfo/actions.rb, line 48
def initialize field, from_field_path
  @field = field
  @from_field_path = from_field_path
end

Public Instance Methods

execute(row) click to toggle source
# File lib/morfo/actions.rb, line 59
def execute row
  extract_value(from_field_path, row)
end
transformed(&blk) click to toggle source
# File lib/morfo/actions.rb, line 53
def transformed &blk
  act = TransformAction.new self, from_field_path, blk
  field.actions[field.field_path] = act
  act
end

Private Instance Methods

extract_value(from, row) click to toggle source
# File lib/morfo/actions.rb, line 67
def extract_value from, row
  from.inject(row) do |resulting_value, key|
    resulting_value ? resulting_value[key] : nil
  end
end