From a7ad9f38367b729d49db78e7cbe13922d3ff70ee Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 13 Dec 2023 16:18:35 +0900 Subject: We need only one line for detecting caller gem name --- lib/bundled_gems.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 3967511cd1..35538bfbf7 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -124,7 +124,7 @@ module Gem::BUNDLED_GEMS # We detect the gem name from caller_locations. We need to skip 2 frames like: # lib/ruby/3.3.0+0/bundled_gems.rb:90:in `warning?'", # lib/ruby/3.3.0+0/bundler/rubygems_integration.rb:247:in `block (2 levels) in replace_require'", - location = caller_locations(3,3)[0]&.path + location = caller_locations(3,1)[0]&.path if File.file?(location) && !location.start_with?(Gem::BUNDLED_GEMS::LIBDIR) caller_gem = nil Gem.path.each do |path| -- cgit v1.2.3