Class: Morfo::Base

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

Class Method Summary collapse

Class Method Details

.field(*field_path) ⇒ Object



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

def self.field *field_path
  act = Morfo::Actions::Field.new(field_path, mapping_actions)
  mapping_actions[field_path] = act
  act
end

.morf(input) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/morfo.rb', line 12

def self.morf input
  input.map {|row|
    output_row = {}
    mapping_actions.each do |field_path, action|
      deep_merge!(output_row, store_value(action.execute(row), field_path))
    end
    output_row
  }
end