Module: Joule::CSV

Defined in:
lib/joule/csv.rb,
lib/joule/csv/parser.rb

Defined Under Namespace

Classes: Parser

Constant Summary collapse

FILE_EXTENSION =
".csv"

Class Method Summary collapse

Class Method Details

.is_csv_file(extension) ⇒ Object



8
9
10
# File 'lib/joule/csv.rb', line 8

def CSV.is_csv_file(extension)
  extension.eql?(FILE_EXTENSION)
end

.parser(extension, data) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/joule/csv.rb', line 12

def CSV.parser(extension, data)
  header = FasterCSV.parse(data).shift
  if header[0].to_s.downcase.eql?("ibike")
    Joule::IBike::Parser.new(data)
  else
    Joule::PowerTap::Parser.new(data)
  end
end