Module: Excelsieur::Mapping
- Included in:
- Import
- Defined in:
- lib/excelsieur/mapping.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(host_class) ⇒ Object
5 6 7 |
# File 'lib/excelsieur/mapping.rb', line 5 def self.included(host_class) host_class.extend ClassMethods end |
Instance Method Details
#map_row_values(row, columns) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/excelsieur/mapping.rb', line 21 def map_row_values(row, columns) @fields.to_a.each_with_object({}) do |field, acc| idx = columns.index(field[:header]) acc[field[:attribute]] = row[idx] end end |