[rubygems/rubygems] Use ! methods once we have a new copy of the string. Use .prepend to avoid allocating a new string.

https://github.com/rubygems/rubygems/commit/2ac35a661f
This commit is contained in:
Josh Nichols 2023-08-16 15:09:00 -04:00 committed by git
parent 29aab66e6b
commit b5a0630cd0

View File

@ -512,8 +512,11 @@ module Bundler
def self.key_for(key)
key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
key = key.to_s.gsub(".", "__").gsub("-", "___").upcase
"BUNDLE_#{key}"
key = key.to_s.gsub(".", "__")
key.gsub!("-", "___")
key.upcase!
key.prepend("BUNDLE_")
end
# TODO: duplicates Rubygems#normalize_uri