aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-07 12:26:45 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-07 12:26:45 +0200
commitb011a7a938b7289b7d08042474ff4bee07efb7fe (patch)
tree14e47474a91385dfe591265a8d978eeb19540479 /activesupport/lib
parenta761d77902cccdace9482d690a70a358a651337e (diff)
parent512057d386075f207d8927a5e0ce3943174d5c78 (diff)
downloadrails-b011a7a938b7289b7d08042474ff4bee07efb7fe.tar.gz
rails-b011a7a938b7289b7d08042474ff4bee07efb7fe.tar.bz2
rails-b011a7a938b7289b7d08042474ff4bee07efb7fe.zip
Merge remote branch 'rolftimmermans/desc_tracker'
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/descendants_tracker.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/descendants_tracker.rb b/activesupport/lib/active_support/descendants_tracker.rb
index 4d1cfacc95..e2a8b4d4e3 100644
--- a/activesupport/lib/active_support/descendants_tracker.rb
+++ b/activesupport/lib/active_support/descendants_tracker.rb
@@ -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