Class: Schlepp::Source::CSV
- Inherits:
-
Object
- Object
- Schlepp::Source::CSV
- Defined in:
- lib/schlepp/source/csv.rb
Instance Method Summary collapse
- #columns ⇒ Object
- #each ⇒ Object
-
#initialize(fp) ⇒ CSV
constructor
A new instance of CSV.
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
#columns ⇒ Object
14 15 16 |
# File 'lib/schlepp/source/csv.rb', line 14 def columns @csv.headers end |
#each ⇒ Object
18 19 20 21 22 |
# File 'lib/schlepp/source/csv.rb', line 18 def each @csv.each do |r| yield [r.fields] end end |