lib/csv2hash/parser/mapping.rb in csv2hash-0.5.0 vs lib/csv2hash/parser/mapping.rb in csv2hash-0.6.0

- old
+ new

@@ -9,17 +9,17 @@ end end end def fill_it parsed_data, source_data - definition.rules.each do |rule| - if rule.fetch :mappable - y, x = rule.fetch :position - if (nested = rule.fetch :nested) + 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][rule.fetch(:key)] = source_data[y][x] + parsed_data[nested][cell.rules.fetch(:key)] = source_data[y][x] else - parsed_data[rule.fetch(:key)] = source_data[y][x] + parsed_data[cell.rules.fetch(:key)] = source_data[y][x] end end end end