Class: XmlReader

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

Overview

Reads in XML records for traject

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_stream, settings) ⇒ XmlReader

Returns a new instance of XmlReader.

Parameters:

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

7
8
9
10
11
# File 'lib/xml_reader.rb', line 7

def initialize(input_stream, settings)
  @settings = Traject::Indexer::Settings.new settings
  @input_stream = input_stream
  @xml = Nokogiri::XML(input_stream)
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml


13
14
15
# File 'lib/xml_reader.rb', line 13

def xml
  @xml
end

Instance Method Details

#each {|xml| ... } ⇒ Object

Yields:


15
16
17
# File 'lib/xml_reader.rb', line 15

def each
  yield(xml)
end