Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::GemcutterUtilities#stored_api_key_named
stored_api_key_named(name)
lib/rubygems/gemcutter_utilities.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/gemcutter_utilities.rb, line 241
def stored_api_key_named(name)
return nil unless name.to_s == "rubygems"
Gem.configuration.credential_store_default_api_key
end
The default key, when name is the name the credentials file knows it by. That file renames :rubygems_api_key to :rubygems on the way in, so the name survives only there, and moving the key into the store would otherwise put it out of reach of –key.
Only that one name. The store is keyed by host, and –key names a key, so looking any other name up there would let –key reach a host’s key and send it somewhere else. The credentials file keeps the two apart by type, since –key arrives as a Symbol and host entries are strings.