Sha256: 7a9199c7420e3188654c91ab717d73b989c3d9afa4f69babf508b55646be835b

Contents?: true

Size: 477 Bytes

Versions: 15

Compression:

Stored size: 477 Bytes

Contents

require 'thread'

require_relative 'base'


module Anschel
  class Output
    class Device < Base
      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
            end
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
anschel-0.7.10 lib/anschel/output/device.rb
anschel-0.7.9 lib/anschel/output/device.rb
anschel-0.7.8 lib/anschel/output/device.rb
anschel-0.7.7 lib/anschel/output/device.rb
anschel-0.7.6 lib/anschel/output/device.rb
anschel-0.7.5 lib/anschel/output/device.rb
anschel-0.7.4 lib/anschel/output/device.rb
anschel-0.7.3 lib/anschel/output/device.rb
anschel-0.7.2 lib/anschel/output/device.rb
anschel-0.7.1 lib/anschel/output/device.rb
anschel-0.7.0 lib/anschel/output/device.rb
anschel-0.6.5 lib/anschel/output/device.rb
anschel-0.6.4 lib/anschel/output/device.rb
anschel-0.6.3 lib/anschel/output/device.rb
anschel-0.6.2 lib/anschel/output/device.rb