Class: Cards::CsvParser
- Includes:
- TabularParser
- Defined in:
- lib/cards/csv_parser.rb
Instance Method Summary collapse
- #default_output_file ⇒ Object
- #each_unparsed_row ⇒ Object
-
#initialize(file) ⇒ CsvParser
constructor
A new instance of CsvParser.
Methods included from TabularParser
#denormalized_rows, #each_row, #rows
Constructor Details
#initialize(file) ⇒ CsvParser
Returns a new instance of CsvParser.
8 9 10 |
# File 'lib/cards/csv_parser.rb', line 8 def initialize(file) @file = file end |
Instance Method Details
#default_output_file ⇒ Object
18 19 20 |
# File 'lib/cards/csv_parser.rb', line 18 def default_output_file File.basename(@file).sub(/\..*/, '') end |
#each_unparsed_row ⇒ Object
12 13 14 15 16 |
# File 'lib/cards/csv_parser.rb', line 12 def each_unparsed_row CSV.open(@file, 'r') do |row| yield row end end |