Class: TextToNoise::LogReader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, mapper) ⇒ LogReader

Returns a new instance of LogReader.



4
5
6
# File 'lib/text_to_noise/log_reader.rb', line 4

def initialize( io, mapper )
  @io, @mapper = io, mapper
end

Instance Attribute Details

#ioObject (readonly)

Returns the value of attribute io.



3
4
5
# File 'lib/text_to_noise/log_reader.rb', line 3

def io
  @io
end

Instance Method Details

#callObject



8
9
10
11
12
13
# File 'lib/text_to_noise/log_reader.rb', line 8

def call()
  while line = io.gets
    @mapper.dispatch line
    TextToNoise.throttle!
  end
end