Class: Morfo::Base
- Inherits:
-
Object
- Object
- Morfo::Base
- Defined in:
- lib/morfo.rb
Class Method Summary collapse
Class Method Details
.field(*field_path) ⇒ Object
9 10 11 12 13 |
# File 'lib/morfo.rb', line 9 def self.field *field_path act = Morfo::Actions::Field.new(field_path, mapping_actions) mapping_actions[field_path] = act act end |
.morf(input) ⇒ Object
15 16 17 |
# File 'lib/morfo.rb', line 15 def self.morf input input.map { |row| morf_single(row) } end |
.morf_single(input) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/morfo.rb', line 19 def self.morf_single input output = {} mapping_actions.each do |field_path, action| output.deep_merge!(store_value(action.execute(input), field_path)) end output end |