[rubygems/rubygems] Explain the 3 states options[:user_install] can have.

This was issue previously, so hopefully this comment tries to state this
explicitly for future readers.

https://github.com/rubygems/rubygems/commit/8ccd830f85
This commit is contained in:
Vít Ondruch 2023-12-12 14:47:15 +01:00 committed by Hiroshi SHIBATA
parent 1fa5dd883e
commit befbcfd90c

View File

@ -680,6 +680,10 @@ class Gem::Installer
unless @gem_home
# `--build-root` overrides `--user-install` and auto-user-install
if @build_root.nil?
# Please note that `options[:user_install]` might have three states:
# * `true`: `--user-install`
# * `false`: `--no-user-install` and
# * `nil`: option was not specified
if options[:user_install]
@gem_home = Gem.user_dir
elsif options[:user_install].nil? && !ENV.key?("GEM_HOME") && (File.exist?(Gem.dir) && !File.writable?(Gem.dir))