lib/io_streams/tabular/parser/csv.rb in iostreams-0.15.0 vs lib/io_streams/tabular/parser/csv.rb in iostreams-0.16.0

- old
+ new

@@ -9,17 +9,21 @@ end # Returns [Array<String>] the header row. # Returns nil if the row is blank. def parse_header(row) - raise(Tabular::Errors::InvalidHeader, "Format is :csv. Invalid input header: #{row.class.name}") unless row.is_a?(String) + return row if row.is_a?(::Array) + raise(IOStreams::Errors::InvalidHeader, "Format is :csv. Invalid input header: #{row.class.name}") unless row.is_a?(String) + csv_parser.parse(row) end # Returns [Array] the parsed CSV line def parse(row) - raise(Tabular::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}") unless row.is_a?(String) + return row if row.is_a?(::Array) + + raise(IOStreams::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}") unless row.is_a?(String) csv_parser.parse(row) end # Return the supplied array as a single line CSV string.