Class: Anschel::Output::Device
- Defined in:
- lib/anschel/output/device.rb
Instance Method Summary collapse
-
#initialize(config, stats, log) ⇒ Device
constructor
A new instance of Device.
Methods inherited from Base
Constructor Details
#initialize(config, stats, log) ⇒ Device
Returns a new instance of Device.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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 end end end end |