Module: ReciteCSV::Reader::Core
- Includes:
- Enumerable
- Defined in:
- lib/recite_csv/reader/core.rb
Instance Attribute Summary collapse
-
#csv_options ⇒ Object
readonly
Returns the value of attribute csv_options.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
Instance Attribute Details
#csv_options ⇒ Object (readonly)
Returns the value of attribute csv_options.
10 11 12 |
# File 'lib/recite_csv/reader/core.rb', line 10 def @csv_options end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
10 11 12 |
# File 'lib/recite_csv/reader/core.rb', line 10 def file @file end |
Instance Method Details
#each ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/recite_csv/reader/core.rb', line 17 def each if block_given? ::CSV.foreach(self.file, self.) do |raw_row| yield self.class::Row.new(raw_row) end else self.to_enum end end |
#initialize(file, csv_options = {}) ⇒ Object
12 13 14 15 |
# File 'lib/recite_csv/reader/core.rb', line 12 def initialize(file, = {}) @file = file @csv_options = ( || {}).merge(self.class::DEFAULT_CSV_OPTIONS) end |