lib/io_streams/tabular/parser/csv.rb in iostreams-1.1.0 vs lib/io_streams/tabular/parser/csv.rb in iostreams-1.1.1
- old
+ new
@@ -1,6 +1,6 @@
-require 'csv'
+require "csv"
module IOStreams
class Tabular
module Parser
class Csv < Base
attr_reader :csv_parser
@@ -23,13 +23,11 @@
# Returns [Array] the parsed CSV line
def parse(row)
return row if row.is_a?(::Array)
- unless row.is_a?(String)
- raise(IOStreams::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}")
- end
+ raise(IOStreams::Errors::TypeMismatch, "Format is :csv. Invalid input: #{row.class.name}") unless row.is_a?(String)
parse_line(row)
end
# Return the supplied array as a single line CSV string.
@@ -48,10 +46,10 @@
CSV.parse_line(line)
end
def render_array(array)
- CSV.generate_line(array, encoding: 'UTF-8', row_sep: '')
+ CSV.generate_line(array, encoding: "UTF-8", row_sep: "")
end
else
def parse_line(line)
csv_parser.parse(line)
end