class ThomasUtils::PeriodicFlusher

Public Class Methods

<<(stream_desc) click to toggle source
# File lib/thomas_utils/periodic_flusher.rb, line 5
def self.<<(stream_desc)
  name = stream_desc[:name]
  unless @@streams[name]
    stream = stream_desc[:stream]
    @@streams[name] = stream
    Workers::PeriodicTimer.new(stream_desc[:timeout] || 1) { stream.flush }
  end
end
[](name) click to toggle source
# File lib/thomas_utils/periodic_flusher.rb, line 14
def self.[](name)
  @@streams[name]
end