From 6d7b0374d12de2ddeaa9c3f896234111ed6bf8e2 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Thu, 2 Feb 2006 16:56:15 +0000 Subject: Add LoadingModule.clear! back temporarily git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3524 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/dependencies.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 7f73f9bf40..0bedbf093c 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -142,6 +142,14 @@ module Dependencies #:nodoc: def const_available?(name) self.const_defined?(name) || load_paths.any? {|lp| lp.filesystem_path(path + [name])} end + + # Erase all items in this module + def clear! + constants.each do |name| + Object.send(:remove_const, name) if Object.const_defined?(name) && Object.const_get(name).object_id == self.const_get(name).object_id + self.send(:remove_const, name) + end + end end class RootLoadingModule < LoadingModule #:nodoc: -- cgit v1.2.3