Module: ReciteCSV::Reader::Core

Includes:
Enumerable
Defined in:
lib/recite_csv/reader/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#csv_optionsObject (readonly)

Returns the value of attribute csv_options.



10
11
12
# File 'lib/recite_csv/reader/core.rb', line 10

def csv_options
  @csv_options
end

#fileObject (readonly)

Returns the value of attribute file.



10
11
12
# File 'lib/recite_csv/reader/core.rb', line 10

def file
  @file
end

#file_optionsObject (readonly)

Returns the value of attribute file_options.



10
11
12
# File 'lib/recite_csv/reader/core.rb', line 10

def file_options
  @file_options
end

Instance Method Details

#each(&block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/recite_csv/reader/core.rb', line 19

def each(&block)
  if block_given?
    _each(&block)
  else
    self.to_enum
  end
end

#initialize(file, options = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/recite_csv/reader/core.rb', line 12

def initialize(file, options = {})
  @file = file
  @file_options = options.delete(:file_options) || {}
  @csv_options =
    (options || {}).merge(self.class::DEFAULT_CSV_OPTIONS)
end