File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ class Gem::Specification < Gem::BasicSpecification
181
181
def self . clear_specs # :nodoc:
182
182
@@all = nil
183
183
@@stubs = nil
184
- @@stubs_by_name = { }
184
+ @@stubs_by_name = TruffleRuby :: ConcurrentMap . new
185
185
@@spec_with_requirable_file = { }
186
186
@@active_stub_with_requirable_file = { }
187
187
end
@@ -818,7 +818,9 @@ def self.stubs
818
818
pattern = "*.gemspec"
819
819
stubs = stubs_for_pattern ( pattern , false )
820
820
821
- @@stubs_by_name = stubs . select { |s | Gem ::Platform . match_spec? s } . group_by ( &:name )
821
+ stubs_by_name = TruffleRuby ::ConcurrentMap . new
822
+ stubs . select { |s | Gem ::Platform . match_spec? s } . group_by ( &:name ) . each_pair { |k , v | stubs_by_name [ k ] = v }
823
+ @@stubs_by_name = stubs_by_name
822
824
stubs
823
825
end
824
826
end
@@ -929,7 +931,9 @@ def self.all
929
931
# -- wilsonb
930
932
931
933
def self . all = ( specs )
932
- @@stubs_by_name = specs . group_by ( &:name )
934
+ stubs_by_name = TruffleRuby ::ConcurrentMap . new
935
+ specs . group_by ( &:name ) . each_pair { |k , v | stubs_by_name [ k ] = v }
936
+ @@stubs_by_name = stubs_by_name
933
937
@@all = @@stubs = specs
934
938
end
935
939
Original file line number Diff line number Diff line change @@ -996,9 +996,9 @@ def test_self_stubs_for_lazy_loading
996
996
save_gemspec ( "b-1" , "1" , dir_standard_specs ) { |s | s . name = "b" }
997
997
998
998
assert_equal [ "a-1" ] , Gem ::Specification . stubs_for ( "a" ) . map { |s | s . full_name }
999
- assert_equal 1 , Gem ::Specification . class_variable_get ( :@@stubs_by_name ) . length
999
+ assert_equal 1 , Gem ::Specification . class_variable_get ( :@@stubs_by_name ) . size
1000
1000
assert_equal [ "b-1" ] , Gem ::Specification . stubs_for ( "b" ) . map { |s | s . full_name }
1001
- assert_equal 2 , Gem ::Specification . class_variable_get ( :@@stubs_by_name ) . length
1001
+ assert_equal 2 , Gem ::Specification . class_variable_get ( :@@stubs_by_name ) . size
1002
1002
1003
1003
assert_equal (
1004
1004
Gem ::Specification . stubs_for ( "a" ) . map { |s | s . object_id } ,
You can’t perform that action at this time.
0 commit comments