Class: ConvenientService::Utils::Kernel::SilenceWarnings

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/kernel/silence_warnings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(&block) ⇒ void

Parameters:



26
27
28
# File 'lib/convenient_service/utils/kernel/silence_warnings.rb', line 26

def initialize(&block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



20
21
22
# File 'lib/convenient_service/utils/kernel/silence_warnings.rb', line 20

def block
  @block
end

Instance Method Details

#callHash

NOTE: When $VERBOSE is set to false, Ruby still emits warnings (at least in RSpec).

Returns:



41
42
43
44
45
46
47
# File 'lib/convenient_service/utils/kernel/silence_warnings.rb', line 41

def call
  old_verbose, $VERBOSE = $VERBOSE, nil

  block.call
ensure
  $VERBOSE = old_verbose
end