Permalink
Browse files

removes unused method Class#subclasses

  • Loading branch information...
1 parent c6104e6 commit ec7c642f5fe60afc857aa64f1a9b4c2be56f9d70 @fxn fxn committed Jan 26, 2010
@@ -16,13 +16,6 @@ def remove_subclasses
Object.remove_subclasses_of(self)
end
- # Returns an array with the names of the subclasses of +self+ as strings.
- #
- # Integer.subclasses # => ["Bignum", "Fixnum"]
- def subclasses
- Object.subclasses_of(self).map { |o| o.to_s }
- end
-
# Removes the classes in +klasses+ from their parent module.
#
# Ordinary classes belong to some module via a constant. This method computes
@@ -34,14 +34,4 @@ def test_removing_class_in_two_level_namespace
Class.remove_class(Y::Z::C)
assert_raise(NameError) { Y::Z::C.is_a?(Class) }
end
-
- def test_retrieving_subclasses
- @parent = eval("class D; end; D")
- @sub = eval("class E < D; end; E")
- @subofsub = eval("class F < E; end; F")
- assert_equal 2, @parent.subclasses.size
- assert_equal [@subofsub.to_s], @sub.subclasses
- assert_equal [], @subofsub.subclasses
- assert_equal [@sub.to_s, @subofsub.to_s].sort, @parent.subclasses.sort
- end
end

0 comments on commit ec7c642

Please sign in to comment.