Sha256: 86fdf25bebf4401eda3a24aba60b2fb1d9357cd49b6bcafadfb41bae7e8c36d1

Contents?: true

Size: 581 Bytes

Versions: 12

Compression:

Stored size: 581 Bytes

Contents

require 'thread'

module Drydock
  module Screen
    extend self
    
    @@mutex = Mutex.new
    @@output = StringIO.new
    @@offset = 0
    
    def print(*msg)
      @@mutex.synchronize do
        @@output.print *msg
      end
    end
    
    def puts(*msg)
      @@mutex.synchronize do
        @@output.puts *msg
      end
    end
    
    def flush
      @@mutex.synchronize do
        #return if @@offset == @@output.tell
        @@output.seek @@offset
        STDOUT.puts @@output.read unless @@output.eof?
        @@offset = @@output.tell
      end
    end
    
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
delano-drydock-0.6.8 lib/drydock/screen.rb
bone-0.3.2 vendor/drydock-0.6.8/lib/drydock/screen.rb
bone-0.3.1 vendor/drydock-0.6.8/lib/drydock/screen.rb
bone-0.3.0 vendor/drydock-0.6.8/lib/drydock/screen.rb
bone-0.2.6 vendor/drydock-0.6.8/lib/drydock/screen.rb
drydock-0.6.9 lib/drydock/screen.rb
bone-0.2.5 vendor/drydock-0.6.8/lib/drydock/screen.rb
bone-0.2.4 vendor/drydock-0.6.8/lib/drydock/screen.rb
bone-0.2.3 vendor/drydock-0.6.8/lib/drydock/screen.rb
bone-0.2.2 vendor/drydock-0.6.8/lib/drydock/screen.rb
bone-0.2.1 vendor/drydock-0.6.8/lib/drydock/screen.rb
drydock-0.6.8 lib/drydock/screen.rb