Module: Drydock::Screen

Extended by:
Screen
Included in:
Screen
Defined in:
lib/drydock/screen.rb

Constant Summary collapse

@@mutex =
Mutex.new
@@output =
StringIO.new
@@offset =
0

Instance Method Summary collapse

Instance Method Details

#flushObject



23
24
25
26
27
28
29
30
# File 'lib/drydock/screen.rb', line 23

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


11
12
13
14
15
# File 'lib/drydock/screen.rb', line 11

def print(*msg)
  @@mutex.synchronize do
    @@output.print *msg
  end
end

#puts(*msg) ⇒ Object



17
18
19
20
21
# File 'lib/drydock/screen.rb', line 17

def puts(*msg)
  @@mutex.synchronize do
    @@output.puts *msg
  end
end