Module: Natour::StdoutUtils

Defined in:
lib/natour/utils/stdout_utils.rb

Class Method Summary collapse

Class Method Details

.suppress_outputObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/natour/utils/stdout_utils.rb', line 5

def suppress_output
  orig_stdout = $stdout.clone
  orig_stderr = $stderr.clone
  $stdout.reopen(File.new(File::NULL, 'w'))
  $stderr.reopen(File.new(File::NULL, 'w'))
  yield
ensure
  $stdout.reopen(orig_stdout)
  $stderr.reopen(orig_stderr)
end