Sha256: c2144bd93fc1614e05c49556d4f43d8bd2404558b9df9a2ca14c10d5ba984e7b
Contents?: true
Size: 810 Bytes
Versions: 10
Compression:
Stored size: 810 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)] = source_data[y][x] else parsed_data[cell.rules.fetch(:key)] = source_data[y][x] end end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems