Class: Fech::Csv

Inherits:
Object
  • Object
show all
Defined in:
lib/fech/csv.rb

Direct Known Subclasses

CsvDoctor

Class Method Summary collapse

Class Method Details

.clean_opts(opts) ⇒ Object



30
31
32
# File 'lib/fech/csv.rb', line 30

def self.clean_opts(opts)
  opts.reject {|k,v| ![:col_sep, :quote_char, :encoding].include?(k)}
end

.parse_row(file_path, opts) ⇒ Object

Loads a given file and parses it into an array, line by line. Basic wrapper around FasterCSV.foreach

Parameters:

  • file_path (String)

    location of the filing on the file system



26
27
28
# File 'lib/fech/csv.rb', line 26

def self.parse_row(file_path, opts)
  foreach(file_path, clean_opts(opts)) { |row| yield row }
end