Module: Okay::WarningHelpers

Included in:
Template
Defined in:
lib/okay/warning_helpers.rb

Overview

Helper functions for suppressing warnings when we know it’s okay.

Instance Method Summary collapse

Instance Method Details

#silence_warnings(&block) ⇒ Object



9
10
11
# File 'lib/okay/warning_helpers.rb', line 9

def silence_warnings(&block)
  with_warnings(nil, &block)
end

#with_warnings(flag, &_block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/okay/warning_helpers.rb', line 13

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