[前][次][番号順一覧][スレッド一覧]

ruby-changes:69796

From: David <ko1@a...>
Date: Thu, 18 Nov 2021 04:37:50 +0900 (JST)
Subject: [ruby-changes:69796] a5cd4a0568 (master): [rubygems/rubygems] Extract a helper method to reset specs

https://git.ruby-lang.org/ruby.git/commit/?id=a5cd4a0568

From a5cd4a056896cbc47c59617305b1ee8e1b5b7911 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Thu, 4 Nov 2021 13:23:35 +0100
Subject: [rubygems/rubygems] Extract a helper method to reset specs

https://github.com/rubygems/rubygems/commit/662de0c990
---
 lib/rubygems/specification.rb | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 304d9116fcf..e1c1a60b1f5 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -182,14 +182,19 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L182
     @@default_value[k].nil?
   end
 
-  @@all = nil
-  @@stubs = nil
-  @@stubs_by_name = {}
+  def self.clear_specs # :nodoc:
+    @@all = nil
+    @@stubs = nil
+    @@stubs_by_name = {}
+    @@spec_with_requirable_file = {}
+    @@active_stub_with_requirable_file = {}
+  end
+  private_class_method :clear_specs
+
+  clear_specs
 
   # Sentinel object to represent "not found" stubs
   NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
-  @@spec_with_requirable_file = {}
-  @@active_stub_with_requirable_file = {}
 
   # Tracking removed method calls to warn users during build time.
   REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
@@ -1223,11 +1228,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1228
   def self.reset
     @@dirs = nil
     Gem.pre_reset_hooks.each {|hook| hook.call }
-    @@all = nil
-    @@stubs = nil
-    @@stubs_by_name = {}
-    @@spec_with_requirable_file = {}
-    @@active_stub_with_requirable_file = {}
+    clear_specs
     clear_load_cache
     unresolved = unresolved_deps
     unless unresolved.empty?
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]