Module: Kernel

Defined in:
lib/ruby-fs-stack/warning_suppressor.rb

Overview

Kernel#with_warnings_suppressed - Supresses warnings in a given block. Require this file to use it or run it directly to perform a self-test.

Author

Rob Pitt

Copyright

Copyright © 2008 Rob Pitt

License

Free to use and modify so long as credit to previous author(s) is left in place.

Instance Method Summary collapse

Instance Method Details

#with_warnings_suppressedObject

Suppresses warnings within a given block.



11
12
13
14
15
16
17
# File 'lib/ruby-fs-stack/warning_suppressor.rb', line 11

def with_warnings_suppressed
  saved_verbosity = $-v
  $-v = nil
  yield
ensure
  $-v = saved_verbosity
end