Class: Kor::Input::Csv

Inherits:
Base
  • Object
show all
Defined in:
lib/kor/input/csv.rb

Direct Known Subclasses

Tsv

Constant Summary collapse

DELIM =
","

Instance Method Summary collapse

Methods inherited from Base

#initialize, #io, #parse

Constructor Details

This class inherits a constructor from Kor::Input::Base

Instance Method Details

#getsObject



16
17
18
19
20
21
22
# File 'lib/kor/input/csv.rb', line 16

def gets
  if line = io.gets
    ::CSV.new(line.strip, col_sep: self.class::DELIM).gets
  else
    nil
  end
end

#headObject



8
9
10
11
12
13
14
# File 'lib/kor/input/csv.rb', line 8

def head
  if line = io.gets
    ::CSV.new(line.strip, col_sep: self.class::DELIM).gets
  else
    raise ReadError, "cannot get csv header"
  end
end