class Hallmonitor::Outputters::IOOutputter

Simple outputter that just prints to an output stream

Public Class Methods

new(name, out) click to toggle source

Builds a new IOOutputter @param name [String] Name for this outputter @param out [IO] Output to write to

Calls superclass method Hallmonitor::Outputter::new
# File lib/hallmonitor/outputters/iooutputter.rb, line 10
def initialize(name, out)
  super(name)
  @out = out
end

Public Instance Methods

process(event) click to toggle source

Sends an event to the configured output on IOError the output will be closed

# File lib/hallmonitor/outputters/iooutputter.rb, line 17
def process(event)
  @out.print "EVENT: #{event.to_json}\n"
  @out.flush
rescue IOError
  close
end

Private Instance Methods

close() click to toggle source
# File lib/hallmonitor/outputters/iooutputter.rb, line 26
def close
  @out.close unless @out.nil?
end