Module: Kernel

Defined in:
lib/ext/ext.rb

Instance Method Summary collapse

Instance Method Details

#silence_stream(stream) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/ext/ext.rb', line 66

def silence_stream(stream)
  old_stream = stream.dup
  stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
  stream.sync = true
  yield
ensure
  stream.reopen(old_stream)
end