Class: FightCSV::DataSource
- Inherits:
-
Object
- Object
- FightCSV::DataSource
- Includes:
- Enumerable
- Defined in:
- lib/fight_csv/data_source.rb
Constant Summary collapse
- ALLOWED_OPTIONS =
[:col_sep, :row_sep, :quote_char]
Instance Method Summary collapse
Instance Method Details
#each ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/fight_csv/data_source.rb', line 14 def each csv = CSV.new(self.io, Hash[.select { |opt| ALLOWED_OPTIONS.include opt }]) additions = {} additions[:header] = csv.shift if self.header csv.each do |row| yield row, additions end end |