lib/io_streams/tabular/parser/csv.rb in iostreams-0.20.3 vs lib/io_streams/tabular/parser/csv.rb in iostreams-1.0.0.beta

- old
+ new

@@ -12,19 +12,23 @@ # Returns [Array<String>] the header row. # Returns nil if the row is blank. def parse_header(row) 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) + unless row.is_a?(String) + raise(IOStreams::Errors::InvalidHeader, "Format is :csv. Invalid input header: #{row.class.name}") + end parse_line(row) end # Returns [Array] the parsed CSV line def parse(row) return row if row.is_a?(::Array) - raise(IOStreams::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}") unless row.is_a?(String) + unless row.is_a?(String) + raise(IOStreams::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}") + end parse_line(row) end # Return the supplied array as a single line CSV string.