Class: IOStreams::Tabular::Parser::Hash

Inherits:
Base
  • Object
show all
Defined in:
lib/io_streams/tabular/parser/hash.rb

Instance Method Summary collapse

Instance Method Details

#parse(row) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/io_streams/tabular/parser/hash.rb', line 6

def parse(row)
  unless row.is_a?(::Hash)
    raise(IOStreams::Errors::TypeMismatch, "Format is :hash. Invalid input: #{row.class.name}")
  end

  row
end

#render(row, header) ⇒ Object



14
15
16
# File 'lib/io_streams/tabular/parser/hash.rb', line 14

def render(row, header)
  header.to_hash(row)
end

#requires_header?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/io_streams/tabular/parser/hash.rb', line 18

def requires_header?
  false
end