Class: Schlepp::Source::CSV

Inherits:
Object
  • Object
show all
Defined in:
lib/schlepp/source/csv.rb

Instance Method Summary collapse

Constructor Details

#initialize(fp) ⇒ CSV

Returns a new instance of CSV.



8
9
10
11
12
# File 'lib/schlepp/source/csv.rb', line 8

def initialize(fp)
  @csv = ::CSV.new(fp, {:headers => true})

  @csv.shift
end

Instance Method Details

#columnsObject



14
15
16
# File 'lib/schlepp/source/csv.rb', line 14

def columns
  @csv.headers
end

#eachObject



18
19
20
21
22
# File 'lib/schlepp/source/csv.rb', line 18

def each
  @csv.each do |r|
    yield [r.fields]
  end
end