Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid regexp match on every call to Gem::Platform.local #7104

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/rubygems/platform.rb
Expand Up @@ -13,9 +13,11 @@ class Gem::Platform
attr_accessor :cpu, :os, :version

def self.local
arch = RbConfig::CONFIG["arch"]
arch = "#{arch}_60" if /mswin(?:32|64)$/.match?(arch)
@local ||= new(arch)
@local ||= begin
arch = RbConfig::CONFIG["arch"]
arch = "#{arch}_60" if /mswin(?:32|64)$/.match?(arch)
new(arch)
end
end

def self.match(platform)
Expand Down