summaryrefslogtreecommitdiff
path: root/lib/rubygems/platform.rb
diff options
context:
space:
mode:
authorSamuel Giddins <[email protected]>2023-12-13 03:46:10 -0800
committergit <[email protected]>2023-12-13 22:00:26 +0000
commitbaf2ec2ca8127cd610a3681a1e84ebcb404fe8f2 (patch)
tree34f648186b45ea9a4927717d78528586d8848c80 /lib/rubygems/platform.rb
parentb266890dab38d12ad52288d5edf60f885ae5b8ce (diff)
[rubygems/rubygems] Use match? when regexp match data is unused
Improved performance / reduced allocations https://github.com/rubygems/rubygems/commit/b04726c9a7
Diffstat (limited to 'lib/rubygems/platform.rb')
-rw-r--r--lib/rubygems/platform.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 3513db13f4..48b7344aee 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -89,7 +89,7 @@ class Gem::Platform
when String then
arch = arch.split "-"
- if arch.length > 2 && arch.last !~ /\d+(\.\d+)?$/ # reassemble x86-linux-{libc}
+ if arch.length > 2 && !arch.last.match?(/\d+(\.\d+)?$/) # reassemble x86-linux-{libc}
extra = arch.pop
arch.last << "-#{extra}"
end
@@ -101,7 +101,7 @@ class Gem::Platform
else cpu
end
- if arch.length == 2 && arch.last =~ /^\d+(\.\d+)?$/ # for command-line
+ if arch.length == 2 && arch.last.match?(/^\d+(\.\d+)?$/) # for command-line
@os, @version = arch
return
end