Skip to content

Commit

Permalink
Use Kernel.singleton_class
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jul 20, 2023
1 parent 4d4c962 commit 75ef8f8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/bundler/rubygems_integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,9 @@ def security_policies
end

def replace_require(specs)
kernel = (class << ::Kernel; self; end)

return if [kernel, ::Kernel].any?{|klass| klass.respond_to?(:no_warning_require)}
return if [::Kernel.singleton_class, ::Kernel].any?{|klass| klass.respond_to?(:no_warning_require)}

[kernel, ::Kernel].each do |kernel_class|
[::Kernel.singleton_class, ::Kernel].each do |kernel_class|
kernel_class.send(:alias_method, :no_warning_require, :require)
kernel_class.send(:define_method, :require) do |file|
name = file.tr("/", "-")
Expand Down

0 comments on commit 75ef8f8

Please sign in to comment.