diff options
author | Xavier Noria <fxn@hashref.com> | 2010-01-26 22:51:44 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-01-26 22:51:44 +0100 |
commit | 44afd785c8e390f47bc5b80e5d94309b6b56a13c (patch) | |
tree | bf981d456bdfb0f3d8f5600da1e2e18c28f6ba63 /activesupport/lib | |
parent | 5f981ff0294ba45aa44ad15aa063970b29aeec44 (diff) | |
download | rails-44afd785c8e390f47bc5b80e5d94309b6b56a13c.tar.gz rails-44afd785c8e390f47bc5b80e5d94309b6b56a13c.tar.bz2 rails-44afd785c8e390f47bc5b80e5d94309b6b56a13c.zip |
removes unused method Class#remove_class
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/class/removal.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/removal.rb b/activesupport/lib/active_support/core_ext/class/removal.rb index 80a920e4d6..74140eb978 100644 --- a/activesupport/lib/active_support/core_ext/class/removal.rb +++ b/activesupport/lib/active_support/core_ext/class/removal.rb @@ -2,35 +2,4 @@ require 'active_support/core_ext/object/extending' require 'active_support/core_ext/module/introspection' class Class #:nodoc: - # Removes the classes in +klasses+ from their parent module. - # - # Ordinary classes belong to some module via a constant. This method computes - # that constant name from the class name and removes it from the module it - # belongs to. - # - # Object.remove_class(Integer) # => [Integer] - # Integer # => NameError: uninitialized constant Integer - # - # Take into account that in general the class object could be still stored - # somewhere else. - # - # i = Integer # => Integer - # Object.remove_class(Integer) # => [Integer] - # Integer # => NameError: uninitialized constant Integer - # i.subclasses # => ["Bignum", "Fixnum"] - # Fixnum.superclass # => Integer - def remove_class(*klasses) - klasses.flatten.each do |klass| - # Skip this class if there is nothing bound to this name - next unless defined?(klass.name) - - basename = klass.to_s.split("::").last - parent = klass.parent - - # Skip this class if it does not match the current one bound to this name - next unless parent.const_defined?(basename) && klass = parent.const_get(basename) - - parent.instance_eval { remove_const basename } unless parent == klass - end - end end |