Class: Fech::Csv
- Inherits:
-
Object
- Object
- Fech::Csv
- Defined in:
- lib/fech/csv.rb
Direct Known Subclasses
Class Method Summary collapse
- .clean_opts(opts) ⇒ Object
-
.parse_row(file_path, opts) ⇒ Object
Loads a given file and parses it into an array, line by line.
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
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 |