Class: Jcsv::ListReader

Inherits:
Reader
  • Object
show all
Defined in:
lib/list_reader.rb

Overview

Defined Under Namespace

Modules: Header, HeaderLess

Instance Attribute Summary

Attributes inherited from Reader

#chunk_size, #col_sep, #column_mapping, #comment_matches, #comment_starts, #data_labels, #dimensions_names, #filename, #headers, #ignore_empty_lines, #processed_column, #quote_char, #rows, #strings_as_keys, #suppress_warnings, #surrounding_space_need_quotes

Instance Method Summary collapse

Methods inherited from Reader

#[], #dimensions, #each, #initialize, #mapping=

Constructor Details

This class inherits a constructor from Jcsv::Reader

Instance Method Details

#read(&block) ⇒ Object


read the file.




39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/list_reader.rb', line 39

def read(&block)

  # When no block given, chunks read are stored in an array and returned to the user.
  if (!block_given?)
    rows = []
      parse_with_block do |line_no, row_no, chunk|
        rows << chunk
      end
    rows
  else
    parse_with_block(&block)
  end
  
end