Class: Bulkrax::CsvEntry::CsvWrapper
- Inherits:
-
Object
- Object
- Bulkrax::CsvEntry::CsvWrapper
- Includes:
- Enumerable
- Defined in:
- app/models/bulkrax/csv_entry.rb
Overview
The purpose of this class is to reject empty lines. This causes lots of grief in importing. But why not use CSV.read‘s `skip_lines` option? Because for some CSVs, it will never finish reading the file.
There is a spec that demonstrates this approach works.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(original) ⇒ CsvWrapper
constructor
A new instance of CsvWrapper.
Constructor Details
#initialize(original) ⇒ CsvWrapper
59 60 61 |
# File 'app/models/bulkrax/csv_entry.rb', line 59 def initialize(original) @original = original end |
Instance Method Details
#each ⇒ Object
65 66 67 68 69 70 |
# File 'app/models/bulkrax/csv_entry.rb', line 65 def each @original.each do |row| next if all_fields_are_empty_for(row: row) yield(row) end end |