[rubygems/rubygems] Extract a local outside the loop

https://github.com/rubygems/rubygems/commit/da1492e9d7
This commit is contained in:
David Rodríguez 2020-05-19 14:32:12 +02:00 committed by Hiroshi SHIBATA
parent 5aa5aad48a
commit 07dca5c02c
Notes: git 2020-06-05 07:33:42 +09:00

View File

@ -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