summaryrefslogtreecommitdiff
path: root/ext/purelib.rb
blob: 6418fd618d9ae0c0738cec166f4ee12151fdca8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
nul = nil
$:.each_with_index {|path, index|
  if /\A(?:\.\/)*-\z/ =~ path
    nul = index
    break
  end
}
if nul
  removed, $:[nul..-1] = $:[nul..-1], ["."]
  if defined?(Gem::QuickLoader)
    removed.each do |path|
      # replaces a fake rubygems by gem_prelude.rb with an alternative path
      index = $".index(File.join(path, 'rubygems.rb'))
      $"[index] = Gem::QuickLoader.path_to_full_rubygems_library if index
    end
  end
end