Sha256: 760d6a6f7c9ec9dd0c8f93c201bf13ff832edea705ef8a840dd1ec7fc19e5149

Contents?: true

Size: 749 Bytes

Versions: 36

Compression:

Stored size: 749 Bytes

Contents

require 'stringio'

class ThreadOut

  def initialize(out)
    @out = out
  end

  def write(stuff='')
    if Thread.current[:stdout] then
      Thread.current[:stdout].write stuff
    else
      @out.write stuff
    end
  end

  def puts(stuff='')
    if Thread.current[:stdout] then
      Thread.current[:stdout].puts stuff
    else
      @out.puts stuff
    end
  end

  def print(stuff='')
    if Thread.current[:stdout] then
      Thread.current[:stdout].puts stuff
    else
      @out.print stuff
    end
  end

  def flush
    if Thread.current[:stdout] then
      Thread.current[:stdout].flush
    else
      @out.flush
    end
  end
end

STDOUT.sync = true
STDERR.sync = true
$stdout = ThreadOut.new(STDOUT)
$stderr = ThreadOut.new(STDERR)

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
bake-toolkit-2.32.0 lib/common/ext/stdout.rb
bake-toolkit-2.31.7 lib/common/ext/stdout.rb
bake-toolkit-2.31.5 lib/common/ext/stdout.rb
bake-toolkit-2.31.4 lib/common/ext/stdout.rb
bake-toolkit-2.31.2 lib/common/ext/stdout.rb
bake-toolkit-2.31.0 lib/common/ext/stdout.rb
bake-toolkit-2.30.0 lib/common/ext/stdout.rb
bake-toolkit-2.29.4 lib/common/ext/stdout.rb
bake-toolkit-2.29.3 lib/common/ext/stdout.rb
bake-toolkit-2.29.2 lib/common/ext/stdout.rb
bake-toolkit-2.29.0 lib/common/ext/stdout.rb
bake-toolkit-2.28.1 lib/common/ext/stdout.rb
bake-toolkit-2.28.0 lib/common/ext/stdout.rb
bake-toolkit-2.27.0 lib/common/ext/stdout.rb
bake-toolkit-2.26.1 lib/common/ext/stdout.rb
bake-toolkit-2.26.0 lib/common/ext/stdout.rb
bake-toolkit-2.25.1 lib/common/ext/stdout.rb
bake-toolkit-2.25.0 lib/common/ext/stdout.rb
bake-toolkit-2.24.6 lib/common/ext/stdout.rb
bake-toolkit-2.24.5 lib/common/ext/stdout.rb