class Anschel::Output::Device
Public Class Methods
new(config, stats, log)
click to toggle source
# File lib/anschel/output/device.rb, line 9 def initialize config, stats, log path = config.delete(:path) || '/dev/stdout' qsize = config.delete(:queue_size) || 2000 @queue = SizedQueue.new qsize @thread = Thread.new do File.open(path, 'w') do |f| loop do f.puts @queue.shift f.flush stats.inc 'output' end end end end