Module: CSVConv::Parser

Defined in:
lib/csvconv/parser.rb

Overview

Parse CSV to Hash

Class Method Summary collapse

Class Method Details

.parse_line(input, header, sep) ⇒ Object



10
11
12
# File 'lib/csvconv/parser.rb', line 10

def parse_line(input, header, sep)
  Hash[header.zip(CSV.parse_line(input, col_sep: sep))]
end

.read_header(input, sep) ⇒ Object



6
7
8
# File 'lib/csvconv/parser.rb', line 6

def read_header(input, sep)
  CSV.parse_line(input.gets, col_sep: sep)
end