lib/io_streams/tabular/parser/json.rb in iostreams-1.1.0 vs lib/io_streams/tabular/parser/json.rb in iostreams-1.1.1
- old
+ new
@@ -1,16 +1,14 @@
-require 'json'
+require "json"
module IOStreams
class Tabular
module Parser
# For parsing a single line of JSON at a time
class Json < Base
def parse(row)
return row if row.is_a?(::Hash)
- unless row.is_a?(String)
- raise(IOStreams::Errors::TypeMismatch, "Format is :json. Invalid input: #{row.class.name}")
- end
+ raise(IOStreams::Errors::TypeMismatch, "Format is :json. Invalid input: #{row.class.name}") unless row.is_a?(String)
JSON.parse(row)
end
# Return the supplied array as a single line JSON string.