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

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Examples:

Common usage.

ConvenientService::Utils::Kernel::SilenceWarnings.call { String = String }

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(&block) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Since:

  • 1.0.0



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)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0



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

def block
  @block
end

Instance Method Details

#callHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

Returns:

Since:

  • 1.0.0



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