lib/eco/api/common/people/default_parsers/csv_parser.rb in eco-helpers-1.0.11 vs lib/eco/api/common/people/default_parsers/csv_parser.rb in eco-helpers-1.0.12
- old
+ new
@@ -9,10 +9,11 @@
@parsers.define_attribute(:csv, dependencies: @options) do |parser|
parser.def_parser do |data, deps|
arr_hash = []
CSV.parse(data, headers: true).each do |row|
row_hash = row.headers.uniq.each_with_object({}) do |attr, hash|
- hash[attr] = row[attr]
+ value = row[attr]
+ hash[attr] = value.to_s.empty?? nil : value
end
arr_hash.push(row_hash)
end
arr_hash
end.def_serializer do |array_hash, deps|