Module: Bracken::Logfile::Stream

Defined in:
lib/bracken/logfile/stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#logfileObject

Returns the value of attribute logfile.



5
6
7
# File 'lib/bracken/logfile/stream.rb', line 5

def logfile
  @logfile
end

#pidObject

Returns the value of attribute pid.



6
7
8
# File 'lib/bracken/logfile/stream.rb', line 6

def pid
  @pid
end

Instance Method Details

#filtered_getsObject

FIXME this could use work



9
10
11
12
# File 'lib/bracken/logfile/stream.rb', line 9

def filtered_gets
  line = gets
  line if logfile.filters.empty? || logfile.filters.any? { |filter| filter.match?(line) }
end

#killObject



14
15
16
17
# File 'lib/bracken/logfile/stream.rb', line 14

def kill
  Process.kill('TERM', pid)
  Process.wait(pid)
end