summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-05-19 14:32:12 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-05 07:32:42 +0900
commit07dca5c02c95322a39833705d3acd87b3adb00ac (patch)
treea3e0432917136b509e24c09dcb607192defa4215
parent5aa5aad48aa3effce60de3559d9bd107bfc9a91d (diff)
[rubygems/rubygems] Extract a local outside the loop
https://github.com/rubygems/rubygems/commit/da1492e9d7
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3184
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index decf482..6a7faaf 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -43,8 +43,9 @@ module Kernel
# https://github.com/rubygems/rubygems/pull/1868
resolved_path = begin
rp = nil
+ load_path_check_index = Gem.load_path_insert_index - Gem.activated_gem_paths
Gem.suffixes.each do |s|
- $LOAD_PATH[0...Gem.load_path_insert_index - Gem.activated_gem_paths].each do |lp|
+ $LOAD_PATH[0...load_path_check_index].each do |lp|
safe_lp = lp.dup.tap(&Gem::UNTAINT)
begin
if File.symlink? safe_lp # for backward compatibility