From 1b2ac25a2fe12d636f90bce1c510667d7accf407 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 26 Jan 2010 22:42:56 +0100 Subject: removes unused Class#remove_subclasses --- .../lib/active_support/core_ext/class/removal.rb | 9 --------- .../test/core_ext/object_and_class_ext_test.rb | 21 --------------------- 2 files changed, 30 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/class/removal.rb b/activesupport/lib/active_support/core_ext/class/removal.rb index 82163eeb30..c76c87e313 100644 --- a/activesupport/lib/active_support/core_ext/class/removal.rb +++ b/activesupport/lib/active_support/core_ext/class/removal.rb @@ -7,15 +7,6 @@ class Class #:nodoc: eval("defined?(::#{self}) && ::#{self}.equal?(self)") end - # Unassociates the class with its subclasses and removes the subclasses - # themselves. - # - # Integer.remove_subclasses # => [Bignum, Fixnum] - # Fixnum # => NameError: uninitialized constant Fixnum - def remove_subclasses - Object.remove_subclasses_of(self) - end - # Removes the classes in +klasses+ from their parent module. # # Ordinary classes belong to some module via a constant. This method computes diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb index e6fbdb637b..4305114f22 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -41,27 +41,6 @@ class Foo end class ClassExtTest < Test::Unit::TestCase - def test_methods - assert defined?(ClassB) - assert defined?(ClassC) - assert defined?(ClassD) - - ClassA.remove_subclasses - - assert !defined?(ClassB) - assert !defined?(ClassC) - assert !defined?(ClassD) - end - - def test_subclasses_of - cj = ClassJ - assert_equal [ClassJ], Object.subclasses_of(ClassI) - ClassI.remove_subclasses - assert_equal [], Object.subclasses_of(ClassI) - ensure - Object.const_set :ClassJ, cj - end - def test_subclasses_of_should_find_nested_classes assert Object.subclasses_of(ClassK).include?(Nested::ClassL) end -- cgit v1.2.3