Class: Cards::CsvParser

Inherits:
Object show all
Includes:
TabularParser
Defined in:
lib/cards/csv_parser.rb

Instance Method Summary collapse

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_fileObject



18
19
20
# File 'lib/cards/csv_parser.rb', line 18

def default_output_file
  File.basename(@file).sub(/\..*/, '')
end

#each_unparsed_rowObject



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