summaryrefslogtreecommitdiff
path: root/lib/bundler/settings.rb
diff options
context:
space:
mode:
authorJosh Nichols <josh.nichols@gusto.com>2023-08-16 14:57:48 -0400
committergit <svn-admin@ruby-lang.org>2023-08-20 09:05:56 +0000
commit921c2bba4e4f0bb89d9ff354c05a176174586064 (patch)
tree74035b90e909be29decc82420c28ba4ddbe6b849 /lib/bundler/settings.rb
parent7e5c3ec5b1fc0afae215ca00d7a1dd5d8f3799c0 (diff)
[rubygems/rubygems] ENV.to_h returns a new hash, so we can `select!` it to avoid allocating another hash.
`String#start_with?` is faster than regex that is bound to the start of a string. https://github.com/rubygems/rubygems/commit/9b2006ef09
Diffstat (limited to 'lib/bundler/settings.rb')
-rw-r--r--lib/bundler/settings.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 3ba378b9c0..2af9b0326b 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -90,7 +90,9 @@ module Bundler
def initialize(root = nil)
@root = root
@local_config = load_config(local_config_file)
- @env_config = ENV.to_h.select {|key, _value| key =~ /\ABUNDLE_.+/ }
+ @env_config = ENV.to_h
+ @env_config.select! {|key, _value| key.start_with?("BUNDLE_") }
+
@global_config = load_config(global_config_file)
@temporary = {}
end