Sha256: ce7a7ec2232c39b4ebe2b802da51546ba910f02133c1273c9000edfe5c6034f7

Contents?: true

Size: 353 Bytes

Versions: 9

Compression:

Stored size: 353 Bytes

Contents

module Natour
  module StdoutUtils
    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
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
natour-0.12.0 lib/natour/utils/stdout_utils.rb
natour-0.11.0 lib/natour/utils/stdout_utils.rb
natour-0.10.0 lib/natour/utils/stdout_utils.rb
natour-0.9.0 lib/natour/utils/stdout_utils.rb
natour-0.8.0 lib/natour/utils/stdout_utils.rb
natour-0.7.0 lib/natour/utils/stdout_utils.rb
natour-0.6.0 lib/natour/utils/stdout_utils.rb
natour-0.5.0 lib/natour/utils/stdout_utils.rb
natour-0.4.0 lib/natour/utils/stdout_utils.rb