Sha256: 00f8016c4b9ee93d6548f21f6422ea39bc7884497eab2eefa88aed70f0354e25

Contents?: true

Size: 304 Bytes

Versions: 3

Compression:

Stored size: 304 Bytes

Contents

module Natour
  module_function

  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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
natour-0.3.0 lib/natour/helpers/suppress_output.rb
natour-0.2.0 lib/natour/helpers/suppress_output.rb
natour-0.1.0 lib/natour/helpers/suppress_output.rb