зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Avoid regexp match on every call to `Gem::Platform.local`
The result of `arch` would be ignored if `@local` is set, so wrap all the logic in `@local ||=` to short-circuit everything https://github.com/rubygems/rubygems/commit/b67d39f3e0
This commit is contained in:
Родитель
b0a9707364
Коммит
7e7d1f0679
|
@ -13,9 +13,11 @@ class Gem::Platform
|
|||
attr_accessor :cpu, :os, :version
|
||||
|
||||
def self.local
|
||||
@local ||= begin
|
||||
arch = RbConfig::CONFIG["arch"]
|
||||
arch = "#{arch}_60" if /mswin(?:32|64)$/.match?(arch)
|
||||
@local ||= new(arch)
|
||||
new(arch)
|
||||
end
|
||||
end
|
||||
|
||||
def self.match(platform)
|
||||
|
|
Загрузка…
Ссылка в новой задаче