Cache Gem.default_dir

RubyGems do internally the same \[[1]\]. This should help with:

1) Performance (not tested)
2) Running RubyGems test suite (main motivation), which actually
   overrides the `@default_dir` \[[2]\] to be able to place test content
   into dedicated directory.

[1]: f8e87eba76/lib/rubygems/defaults.rb (L38)
[2]: f8e87eba76/test/rubygems/helper.rb (L372)
This commit is contained in:
Vít Ondruch 2023-11-03 17:03:09 +01:00
parent d432c95c15
commit 5fd12c42e7

View File

@ -113,7 +113,7 @@ module Gem
# RubyGems default overrides.
def default_dir
Gem.default_dirs[:system][:gem_dir]
@default_dir ||= Gem.default_dirs[:system][:gem_dir]
end
def default_path