1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Set @@all variable at class definition time

To spare the `defined?` check.

https://github.com/rubygems/rubygems/commit/64d27bba01
This commit is contained in:
David Rodríguez 2021-11-04 13:12:32 +01:00 committed by git
parent 4acac918f4
commit fdd3eed037

View file

@ -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