Module: ArcFurnace::CSVToHashWithDuplicateHeaders
- Included in:
- CSVSource, MultiCSVSource
- Defined in:
- lib/arc-furnace/csv_to_hash_with_duplicate_headers.rb
Instance Method Summary collapse
Instance Method Details
#csv_to_hash_with_duplicates(row) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/arc-furnace/csv_to_hash_with_duplicate_headers.rb', line 3 def csv_to_hash_with_duplicates(row) result = {} row.each do |column, value| unless value.nil? existing_value = result[column] result[column] = if existing_value Array.wrap(existing_value) + [ value ] else value end end end result end |