Class: Wtails::Tail::Reader

Inherits:
EventMachine::FileTail
  • Object
show all
Defined in:
lib/wtails/tail.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, startpos = -1)) ⇒ Reader

Returns a new instance of Reader.



21
22
23
24
# File 'lib/wtails/tail.rb', line 21

def initialize(path, startpos=-1)
  super(path, startpos)
  @buffer = BufferedTokenizer.new
end

Instance Method Details

#receive_data(data) ⇒ Object



26
27
28
29
30
# File 'lib/wtails/tail.rb', line 26

def receive_data(data)
  @buffer.extract(data).each do |line|
    Wtails.channel(path) << line
  end
end