From fdd3eed037feabaf2daaa9e1ccec22ad751c5b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 4 Nov 2021 13:12:32 +0100 Subject: [PATCH] [rubygems/rubygems] Set `@@all` variable at class definition time To spare the `defined?` check. https://github.com/rubygems/rubygems/commit/64d27bba01 --- lib/rubygems/specification.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index d684ff0ced..1c7632fd37 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -182,6 +182,7 @@ class Gem::Specification < Gem::BasicSpecification @@default_value[k].nil? end + @@all = nil @@stubs = nil @@stubs_by_name = {} @@ -748,7 +749,7 @@ class Gem::Specification < Gem::BasicSpecification attr_accessor :specification_version def self._all # :nodoc: - unless defined?(@@all) && @@all + unless @@all @@all = stubs.map(&:to_spec) # After a reset, make sure already loaded specs