Skip to content

Commit

Permalink
Merge pull request #36762 from Shopify/descendants-tracker-cleanup
Browse files Browse the repository at this point in the history
Optimize DescendantsArray insertions
  • Loading branch information
rafaelfranca committed Jul 25, 2019
2 parents 1d83ab9 + 62a1d7e commit 53d9bb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions activesupport/lib/active_support/descendants_tracker.rb
Expand Up @@ -77,15 +77,17 @@ def initialize_copy(orig)
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
Expand Down

0 comments on commit 53d9bb9

Please sign in to comment.