aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/class
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-02-02 04:54:07 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-02-02 04:54:07 +0000
commit7a43a05a2b236123329be3198c149c8e894b0450 (patch)
tree14995d46ed0a59689d578e50a44498592f1d0a66 /activesupport/lib/active_support/core_ext/class
parent65c337ac856f7cbfa521b8e6a7d1d234b4873038 (diff)
downloadrails-7a43a05a2b236123329be3198c149c8e894b0450.tar.gz
rails-7a43a05a2b236123329be3198c149c8e894b0450.tar.bz2
rails-7a43a05a2b236123329be3198c149c8e894b0450.zip
Further improvements to reloading code
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3519 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/class')
-rw-r--r--activesupport/lib/active_support/core_ext/class/removal.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/removal.rb b/activesupport/lib/active_support/core_ext/class/removal.rb
index 8fc4d728b3..468c77d81b 100644
--- a/activesupport/lib/active_support/core_ext/class/removal.rb
+++ b/activesupport/lib/active_support/core_ext/class/removal.rb
@@ -7,15 +7,11 @@ class Class #:nodoc:
Object.subclasses_of(self).map { |o| o.to_s }
end
- def remove_class(klass)
- if klass.to_s.include? "::"
- modules = klass.to_s.split("::")
- final_klass = modules.pop
-
- final_module = modules.inject(Object) { |final_type, part| final_type.const_get(part) }
- final_module.send(:remove_const, final_klass) rescue nil
- else
- Object.send(:remove_const, klass.to_s) rescue nil
+ def remove_class(*klasses)
+ klasses.each do |klass|
+ basename = klass.to_s.split("::").last
+ parent = klass.parent
+ parent.send :remove_const, basename unless parent == klass
end
end
end \ No newline at end of file