Sha256: 7d873e17fd677dbd6dc67a187dda68b4ecd8099d25e2ba236e29cfbaad3b47eb
Contents?: true
Size: 824 Bytes
Versions: 4
Compression:
Stored size: 824 Bytes
Contents
module Csv2hash module Parser module Mapping include Parser def fill! self.data = {}.tap do |data_computed| data_computed[:data] ||= [] data_computed[:data] << {}.tap do |data_parsed| fill_it data_parsed, data_source end end end def fill_it parsed_data, source_data definition.cells.each do |cell| if cell.rules.fetch :mappable y, x = cell.rules.fetch :position if (nested = cell.rules.fetch :nested) parsed_data[nested] ||= {} parsed_data[nested][cell.rules.fetch(:key)] = treat(source_data[y][x]) else parsed_data[cell.rules.fetch(:key)] = treat(source_data[y][x]) end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
csv2hash-0.7.7 | lib/csv2hash/parser/mapping.rb |
csv2hash-0.7.6 | lib/csv2hash/parser/mapping.rb |
csv2hash-0.7.5 | lib/csv2hash/parser/mapping.rb |
csv2hash-0.7.3 | lib/csv2hash/parser/mapping.rb |