mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert "Revert "It should be possible to use ActiveSupport::DescendantTracker without getting ActiveSupport::Dependencies for free.""
This reverts commit 9f5b1e1ed0
.
Tests have been refactored so they pass in isolation.
This commit is contained in:
parent
76e4e2fa46
commit
d89a7967b5
1 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,3 @@
|
|||
require 'active_support/dependencies'
|
||||
|
||||
module ActiveSupport
|
||||
# This module provides an internal implementation to track descendants
|
||||
# which is faster than iterating through ObjectSpace.
|
||||
|
@ -18,12 +16,16 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def self.clear
|
||||
@@direct_descendants.each do |klass, descendants|
|
||||
if ActiveSupport::Dependencies.autoloaded?(klass)
|
||||
@@direct_descendants.delete(klass)
|
||||
else
|
||||
descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) }
|
||||
if defined? ActiveSupport::Dependencies
|
||||
@@direct_descendants.each do |klass, descendants|
|
||||
if ActiveSupport::Dependencies.autoloaded?(klass)
|
||||
@@direct_descendants.delete(klass)
|
||||
else
|
||||
descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) }
|
||||
end
|
||||
end
|
||||
else
|
||||
@@direct_descendants.clear
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue