Method: Fech::Filing#each_row
- Defined in:
- lib/fech/filing.rb
#each_row(opts = {}) {|Array| ... } ⇒ Object
Iterates over and yields the Filing’s lines
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/fech/filing.rb', line 321 def each_row(opts={}, &block) unless File.exists?(file_path) raise "File #{file_path} does not exist. Try invoking the .download method on this Filing object." end # If this is an F99, we need to parse it differently. resave_f99_contents if ['F99', '"F99"'].include? form_type c = 0 @csv_parser.parse_row(@customized ? custom_file_path : file_path, opts.merge(:col_sep => delimiter, :quote_char => @quote_char, :skip_blanks => true, :encoding => @encoding)) do |row| if opts[:with_index] yield [row, c] c += 1 else yield row end end end |