Class: TrajectPlus::CsvReader

Inherits:
Object
  • Object
show all
Defined in:
lib/traject_plus/csv_reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_stream, settings) ⇒ CsvReader

Returns a new instance of CsvReader.

Parameters:

  • input_stream (File)
  • settings (Traject::Indexer::Settings)


10
11
12
13
14
# File 'lib/traject_plus/csv_reader.rb', line 10

def initialize(input_stream, settings)
  @settings = Traject::Indexer::Settings.new settings
  @input_stream = input_stream
  @csv = CSV.parse(input_stream, headers: true)
end

Instance Attribute Details

#csvObject (readonly)

Returns the value of attribute csv.



20
21
22
# File 'lib/traject_plus/csv_reader.rb', line 20

def csv
  @csv
end

Instance Method Details

#each(*args, &block) ⇒ Object



16
17
18
# File 'lib/traject_plus/csv_reader.rb', line 16

def each(*args, &block)
  csv.each(*args, &block)
end