mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
Suppress bundled gem warning on `binding.irb'
This patch silences the "this won't work in the next version of Ruby"
warning displayed when irb is autoloaded via `binding.irb`.
main.rb:1: warning: irb used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0.
You can add irb to your Gemfile or gemspec to fix this error.
/.../irb.rb:9: warning: reline used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0.
You can add reline to your Gemfile or gemspec to fix this error.
From: main.rb @ line 1 :
=> 1: binding.irb
/.../input-method.rb:284: warning: rdoc used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0.
You can add rdoc to your Gemfile or gemspec to fix this error.
This warning is incorrect and misleading: users should not need to
include irb (and its dependencies) to their Gemfiles to use
`binding.irb`, even in future versions of Ruby. It is agreed that the
runtime takes care of that.
This commit is contained in:
parent
2d79cc9bfc
commit
ca9c61800b
Notes:
git
2026-01-15 08:21:04 +00:00
@ -122,6 +122,10 @@ module Gem::BUNDLED_GEMS # :nodoc:
|
||||
false
|
||||
end
|
||||
|
||||
if suppress_list = Thread.current[:__bundled_gems_warning_suppression]
|
||||
return if suppress_list.include?(name) || suppress_list.include?(feature)
|
||||
end
|
||||
|
||||
return if specs.include?(name)
|
||||
|
||||
# Don't warn if a hyphenated gem provides this feature
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
class Binding
|
||||
# :nodoc:
|
||||
def irb(...)
|
||||
suppress = Thread.current[:__bundled_gems_warning_suppression]
|
||||
Thread.current[:__bundled_gems_warning_suppression] = ['irb', 'reline', 'rdoc']
|
||||
|
||||
begin
|
||||
require 'irb'
|
||||
rescue LoadError, Gem::LoadError
|
||||
@ -8,6 +11,8 @@ class Binding
|
||||
require 'irb'
|
||||
end
|
||||
irb(...)
|
||||
ensure
|
||||
Thread.current[:__bundled_gems_warning_suppression] = suppress
|
||||
end
|
||||
|
||||
# suppress redefinition warning
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user