Sha256: afe7a31b2b8eb7c0c78a4acac6059b57574567a8396604392e0f5cd34c86e4c3
Contents?: true
Size: 685 Bytes
Versions: 8
Compression:
Stored size: 685 Bytes
Contents
require 'json' module Hallmonitor module Outputters # Simple outputter that just prints to an output stream class IOOutputter < Outputter # Builds a new IOOutputter # @param name [String] Name for this outputter # @param out [IO] Output to write to def initialize(name, out) super(name) @out = out end # Sends an event to the configured output # on IOError the output will be closed def process(event) @out.print "EVENT: #{event.to_json}\n" @out.flush rescue IOError close end private def close @out.close unless @out.nil? end end end end
Version data entries
8 entries across 8 versions & 1 rubygems