summaryrefslogtreecommitdiff
path: root/lib/rubygems/core_ext
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-12-13 20:19:08 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-12-13 20:19:33 +0900
commit82cc2843a92b286cc13afd0860a4e111d4ea2a0b (patch)
treea517dedd40d35540930cea7732f5a36e76a549e8 /lib/rubygems/core_ext
parent26774351dc5f494253ba031e4bc453dc4dddb2cf (diff)
Prepare to release RubyGems 3.1.0 final version.
Diffstat (limited to 'lib/rubygems/core_ext')
-rw-r--r--lib/rubygems/core_ext/kernel_warn.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/rubygems/core_ext/kernel_warn.rb b/lib/rubygems/core_ext/kernel_warn.rb
index 96da272..6ea72b1 100644
--- a/lib/rubygems/core_ext/kernel_warn.rb
+++ b/lib/rubygems/core_ext/kernel_warn.rb
@@ -6,13 +6,17 @@ if RUBY_VERSION >= "2.5"
module Kernel
path = "#{__dir__}/" # Frames to be skipped start with this path.
- # Suppress "method redefined" warning
- original_warn = instance_method(:warn)
- Module.new {define_method(:warn, original_warn)}
-
original_warn = method(:warn)
- module_function define_method(:warn) {|*messages, **kw|
+ remove_method :warn
+
+ class << self
+
+ remove_method :warn
+
+ end
+
+ define_method(:warn) do |*messages, **kw|
unless uplevel = kw[:uplevel]
if Gem.java_platform?
return original_warn.call(*messages)
@@ -46,6 +50,6 @@ if RUBY_VERSION >= "2.5"
kw[:uplevel] = uplevel
original_warn.call(*messages, **kw)
- }
+ end
end
end