Class: IOStreams::Tabular::Parser::Csv
- Defined in:
- lib/io_streams/tabular/parser/csv.rb
Instance Method Summary collapse
-
#parse(row) ⇒ Object
Returns [Array] the parsed CSV line.
-
#render(row, header) ⇒ Object
Return the supplied array as a single line CSV string.
Methods inherited from Base
Instance Method Details
#parse(row) ⇒ Object
Returns [Array] the parsed CSV line
7 8 9 10 11 12 13 |
# File 'lib/io_streams/tabular/parser/csv.rb', line 7 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) parse_line(row) end |
#render(row, header) ⇒ Object
Return the supplied array as a single line CSV string.
16 17 18 19 |
# File 'lib/io_streams/tabular/parser/csv.rb', line 16 def render(row, header) array = header.to_array(row) render_array(array) end |