module CSVConv::Parser
Parse CSV to Hash
Public Class Methods
parse_line(input, header, sep)
click to toggle source
# 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)
click to toggle source
# File lib/csvconv/parser.rb, line 6 def read_header(input, sep) CSV.parse_line(input.gets, col_sep: sep) end
Private Instance Methods
parse_line(input, header, sep)
click to toggle source
# 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)
click to toggle source
# File lib/csvconv/parser.rb, line 6 def read_header(input, sep) CSV.parse_line(input.gets, col_sep: sep) end