lib/eco/api/common/people/default_parsers/csv_parser.rb in eco-helpers-2.0.60 vs lib/eco/api/common/people/default_parsers/csv_parser.rb in eco-helpers-2.0.61

- old
+ new

@@ -1,11 +1,11 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Loaders::Parser attribute :csv def parser(data, deps) Eco::CSV.parse(data, headers: true, skip_blanks: true).tap do |table| - check_headers(table) if deps[:check_headers] + check_headers(table) if deps[:check_headers] && !options.dig(:input, :skip_header_check) end.each_with_object([]) do |row, arr_hash| row_hash = row.headers.uniq.each_with_object({}) do |attr, hash| next if attr.to_s.strip.empty? hash[attr.strip] = parse_string(row[attr]) end @@ -23,9 +23,13 @@ end CSV::Table.new(arr_rows).to_csv end private + + def options + ASSETS.cli.options + end def parse_string(value) return nil if value.to_s.empty? return nil if null?(value) value