Remove kernel/reporting extension

This commit is contained in:
Douglas Eichelberger 2023-04-26 09:08:40 -07:00
parent 512d7c9613
commit 03ee70b1ae
4 changed files with 3 additions and 48 deletions

1
.gitignore vendored
View File

@ -80,7 +80,6 @@
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/inflections.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/multibyte.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/enumerable.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/kernel/reporting.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/i18n.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/inflector/transliterate.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/inflector/methods.rb

View File

@ -18,7 +18,6 @@ require "active_support/core_ext/file/atomic"
require "active_support/core_ext/hash/deep_merge"
require "active_support/core_ext/hash/except"
require "active_support/core_ext/hash/keys"
require "active_support/core_ext/kernel/reporting"
require "active_support/core_ext/object/blank"
require "active_support/core_ext/object/try"
require "active_support/core_ext/string/exclude"

View File

@ -33,7 +33,9 @@ module Utils
next if Tab.for_keg(formula.any_installed_keg).poured_from_bottle
formula.deps.select(&:build?).each do |dep|
Kernel.suppress(FormulaUnavailableError) { dependents << dep.to_formula }
dependents << dep.to_formula
rescue FormulaUnavailableError
# do nothing
end
end
formulae - dependents

View File

@ -1,45 +0,0 @@
# frozen_string_literal: true
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) { yield }
end
# Sets $VERBOSE to +true+ for the duration of the block and back to its
# original value afterwards.
def enable_warnings
with_warnings(true) { yield }
end
# Sets $VERBOSE for the duration of the block and back to its original
# value afterwards.
def with_warnings(flag)
old_verbose, $VERBOSE = $VERBOSE, flag
yield
ensure
$VERBOSE = old_verbose
end
# Blocks and ignores any exception passed as argument if raised within the block.
#
# suppress(ZeroDivisionError) do
# 1/0
# puts 'This code is NOT reached'
# end
#
# puts 'This code gets executed and nothing related to ZeroDivisionError was seen'
def suppress(*exception_classes)
yield
rescue *exception_classes
end
end