Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Gem::ConfigFile.credential_store_account
credential_store_account(host)
lib/rubygems/config_file.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/config_file.rb, line 752
def self.credential_store_account(host)
host = normalize_credentials_key(host).to_s
return host unless host.match?(%r{\Ahttps?://}i)
require_relative "vendor/uri/lib/uri"
uri = Gem::URI(host)
return host unless uri.userinfo
uri = uri.dup
uri.user = uri.password = nil
uri.to_s
rescue Gem::URI::Error
host
end
Built on the same normalized form the credentials file uses, so the two never disagree about which host a spelling refers to. Userinfo is dropped because the account reaches the backend as a command argument, where any other user on the machine can read it.