lib/table_sync/receiving/handler.rb in table_sync-6.0.4 vs lib/table_sync/receiving/handler.rb in table_sync-6.1.0

- old
+ new

@@ -75,11 +75,11 @@ end end end def processed_data(config) - data.map do |row| + data.filter_map do |row| next if config.skip(row: row) row = row.dup config.mapping_overrides(row: row).each do |before, after| @@ -95,11 +95,11 @@ rest_key = config.rest_key(row: row, rest: rest) (row[rest_key] ||= {}).merge!(rest) if rest_key row - end.compact + end end def validate_data(data, target_keys:) data.each do |row| next if target_keys.all? { |x| row.key?(x) } @@ -113,10 +113,10 @@ raise TableSync::DataError.new(data, target_keys, "Duplicate rows found!") end keys_sample = data[0].keys keys_diff = data.each_with_object(Set.new) do |row, set| - (row.keys - keys_sample | keys_sample - row.keys).each { |x| set.add(x) } + ((row.keys - keys_sample) | (keys_sample - row.keys)).each { |x| set.add(x) } end unless keys_diff.empty? raise TableSync::DataError.new(data, target_keys, <<~MESSAGE) Bad batch structure, check keys: #{keys_diff.to_a}