Module: Kernel

Defined in:
lib/drupid.rb

Overview

To silence (most) warnings from a required file

Instance Method Summary collapse

Instance Method Details

#silence_warningsObject



28
29
30
# File 'lib/drupid.rb', line 28

def silence_warnings
  with_warnings(nil) { yield }
end

#with_warnings(flag) ⇒ Object



32
33
34
35
36
37
# File 'lib/drupid.rb', line 32

def with_warnings(flag)
  old_verbose, $VERBOSE = $VERBOSE, flag
  yield
ensure
  $VERBOSE = old_verbose
end