diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2019-07-25 11:37:39 -0400 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2019-07-25 11:37:39 -0400 |
commit | 62a1d7e9c183c418890d36c3f0068eb815a506d0 (patch) | |
tree | 9d775cc698c6870e1d5488f661b68f078a466a66 /activesupport | |
parent | 55eba62a1074a4c1e70a9b96b78b3dbf812f5e9a (diff) | |
download | rails-62a1d7e9c183c418890d36c3f0068eb815a506d0.tar.gz rails-62a1d7e9c183c418890d36c3f0068eb815a506d0.tar.bz2 rails-62a1d7e9c183c418890d36c3f0068eb815a506d0.zip |
Optimize DescendantsArray insertions
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/descendants_tracker.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/descendants_tracker.rb b/activesupport/lib/active_support/descendants_tracker.rb index 1dad4f923e..b14842bf67 100644 --- a/activesupport/lib/active_support/descendants_tracker.rb +++ b/activesupport/lib/active_support/descendants_tracker.rb @@ -77,15 +77,17 @@ module ActiveSupport end def <<(klass) - cleanup! @refs << WeakRef.new(klass) end def each - @refs.each do |ref| + @refs.reject! do |ref| yield ref.__getobj__ + false rescue WeakRef::RefError + true end + self end def refs_size |