summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Nichols <josh.nichols@gusto.com>2023-08-16 15:09:00 -0400
committergit <svn-admin@ruby-lang.org>2023-08-20 09:06:48 +0000
commitb5a0630cd039afe1aaf523bfe0dd66e282b0c587 (patch)
treea2b1424a73bdda71559826ae3d7c9b9b8cbe4ed4
parent29aab66e6b7e71e139644817109c20a26fa05f3e (diff)
[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
-rw-r--r--lib/bundler/settings.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 3aba4247a0..0c2fefb027 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -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