class Gallus::Output::Stream
Public: Simple, thread-safe IO stream output handler. Takes stream and format on input.
Public Class Methods
new(stream, format)
click to toggle source
# File lib/gallus/output/stream.rb, line 5 def initialize(stream, format) @mutex = Mutex.new @stream, @format = stream, format end
Public Instance Methods
call(event)
click to toggle source
# File lib/gallus/output/stream.rb, line 10 def call(event) @mutex.synchronize { call!(event) } end
call!(event)
click to toggle source
# File lib/gallus/output/stream.rb, line 14 def call!(event) @stream.write(@format.call(event) + "\n") end