Sha256: eab2998053b7b7e9d718ef8e4a6e6f1c09c1e8c392ce79776fc3cbd1a611cede

Contents?: true

Size: 889 Bytes

Versions: 8

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

# @private
# Patched from: rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb
# https://github.com/rails/rails/blob/04972d9b9ef60796dc8f0917817b5392d61fcf09/activesupport/lib/active_support/core_ext/kernel/reporting.rb#L26

# Kernel extensions
module Kernel
  module_function

  # Sets $VERBOSE to +nil+ for the duration of the block and back to its original
  # value afterwards.
  #
  #   silence_warnings do
  #     value = noisy_call # no warning voiced
  #   end
  #
  #   noisy_call # warning voiced
  def silence_warnings(&)
    with_warnings(nil, &)
  end

  # Sets $VERBOSE for the duration of the block and back to its original
  # value afterwards.
  # noinspection RubyGlobalVariableNamingConvention
  def with_warnings(flag)
    old_verbose = $VERBOSE
    $VERBOSE = flag
    yield
  ensure
    $VERBOSE = old_verbose
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sc2ai-0.2.0 lib/sc2ai/overrides/kernel.rb
sc2ai-0.1.0 lib/sc2ai/overrides/kernel.rb
sc2ai-0.0.8 lib/sc2ai/overrides/kernel.rb
sc2ai-0.0.7 lib/sc2ai/overrides/kernel.rb
sc2ai-0.0.5 lib/sc2ai/overrides/kernel.rb
sc2ai-0.0.4 lib/sc2ai/overrides/kernel.rb
sc2ai-0.0.3 lib/sc2ai/overrides/kernel.rb
sc2ai-0.0.2 lib/sc2ai/overrides/kernel.rb