Class: CsvReader::ParserJson

Inherits:
Object
  • Object
show all
Defined in:
lib/csvreader/parser_json.rb

Instance Method Summary collapse

Instance Method Details

#parse(data, **kwargs, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/csvreader/parser_json.rb', line 7

def parse( data, **kwargs, &block )
  ## note: kwargs NOT used for now (but required for "protocol/interface" by other parsers)

  ## note: input: required each_line (string or io/file for example)
  ## assume data is a string or io/file handle
  csv = CsvJson.new( data )

  if block_given?
    csv.each( &block )
  else
    csv.to_a
  end
end