mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
It should be possible to use ActiveSupport::DescendantTracker without getting ActiveSupport::Dependencies for free.
This commit is contained in:
committed by
José Valim
parent
58de03f077
commit
46f6a2e388
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user