lib/io_streams/tabular/parser/array.rb in iostreams-0.20.3 vs lib/io_streams/tabular/parser/array.rb in iostreams-1.0.0.beta
- old
+ new
@@ -4,23 +4,28 @@
module Parser
class Array < Base
# Returns [Array<String>] the header row.
# Returns nil if the row is blank.
def parse_header(row)
- raise(IOStreams::Errors::InvalidHeader, "Format is :array. Invalid input header: #{row.class.name}") unless row.is_a?(::Array)
+ unless row.is_a?(::Array)
+ raise(IOStreams::Errors::InvalidHeader, "Format is :array. Invalid input header: #{row.class.name}")
+ end
+
row
end
# Returns Array
def parse(row)
- raise(IOStreams::Errors::TypeMismatch, "Format is :array. Invalid input: #{row.class.name}") unless row.is_a?(::Array)
+ unless row.is_a?(::Array)
+ raise(IOStreams::Errors::TypeMismatch, "Format is :array. Invalid input: #{row.class.name}")
+ end
+
row
end
def render(row, header)
header.to_array(row)
end
-
end
end
end
end