Class: Loghandler::Tailer

Inherits:
EventMachine::FileTail
  • Object
show all
Defined in:
lib/loghandler/tailer.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, channel) ⇒ Tailer

Returns a new instance of Tailer.



2
3
4
5
6
# File 'lib/loghandler/tailer.rb', line 2

def initialize(options,channel)
  @options = options
  @channel = channel
  super(options[:file])
end

Instance Method Details

#receive_data(data) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/loghandler/tailer.rb', line 8

def receive_data(data)
  data.each_line do |line|
    line.split("\n").each do |sline|
      @channel.push sline
    end
  end
end