Class: Traject::AlephSequentialReader
- Inherits:
-
Object
- Object
- Traject::AlephSequentialReader
- Includes:
- Enumerable
- Defined in:
- lib/traject/alephsequential_reader.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(input_stream, settings) ⇒ AlephSequentialReader
constructor
A new instance of AlephSequentialReader.
- #logger ⇒ Object
Constructor Details
#initialize(input_stream, settings) ⇒ AlephSequentialReader
Returns a new instance of AlephSequentialReader.
10 11 12 13 14 15 16 17 18 |
# File 'lib/traject/alephsequential_reader.rb', line 10 def initialize(input_stream, settings) @settings = settings @input_stream = input_stream if settings['command_line.filename'] =~ /\.gz$/ && !(@input_stream.is_a? Zlib::GzipReader) @input_stream = Zlib::GzipReader.new(@input_stream, :external_encoding => "UTF-8") end @internal_reader = MARC::AlephSequential::Reader.new(@input_stream) end |
Instance Method Details
#each ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/traject/alephsequential_reader.rb', line 24 def each unless block_given? return enum_for(:each) end @internal_reader.each {|r| yield r} end |
#logger ⇒ Object
20 21 22 |
# File 'lib/traject/alephsequential_reader.rb', line 20 def logger @logger ||= (settings[:logger] || Yell.new(STDERR, :level => "gt.fatal")) # null logger) end |