Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::ConfigFile#credential_store_api_key_for
credential_store_api_key_for(host)
lib/rubygems/config_file.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/config_file.rb, line 440
def credential_store_api_key_for(host)
return nil if host.nil? || host.to_s.empty?
return nil unless credential_store
return nil unless store = active_credential_store
store.get(self.class.credential_store_account(host))
end
Looks up host‘s own API key from the credential store, when the credential_store setting is on. Only the host-specific account is consulted: falling back to the default account here would send the RubyGems.org key to whatever host was asked for, ahead of that host’s own key in the credentials file. credential_store_default_api_key covers the default account, at the precedence the credentials file uses for it.