summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-13 16:18:35 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-13 17:30:48 +0900
commita7ad9f38367b729d49db78e7cbe13922d3ff70ee (patch)
tree30f2a5cfe71a6fa5a36f4a363390e38aaadba22d
parente282d7b880c3ac394ad8d41bde858c4534fb3188 (diff)
We need only one line for detecting caller gem name
-rw-r--r--lib/bundled_gems.rb2
1 files changed, 1 insertions, 1 deletions
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|