aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/active_support_core_extensions.textile
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-02-11 00:20:37 +0100
committerXavier Noria <fxn@hashref.com>2010-02-11 00:20:37 +0100
commit72c83893a5221c1054347bda2be09ee4b7f3a897 (patch)
tree56980759eea91f27cca2cd5f74880afd60f8b1db /railties/guides/source/active_support_core_extensions.textile
parent6a395c68d20bf72db826c53d5f44b3bde5069699 (diff)
downloadrails-72c83893a5221c1054347bda2be09ee4b7f3a897.tar.gz
rails-72c83893a5221c1054347bda2be09ee4b7f3a897.tar.bz2
rails-72c83893a5221c1054347bda2be09ee4b7f3a897.zip
AS guide: documents Class#subclasses
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile33
1 files changed, 33 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index da22b4113d..f58bed54d7 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -977,6 +977,39 @@ If for whatever reason an application loads the definition of a mailer class and
NOTE: Defined in +active_support/core_ext/class/delegating_attributes.rb+.
+h4. Descendants
+
+h5. +subclasses+
+
+The +subclasses+ method returns the names of all the anonymous or reachable descendants of its receiver as an array of strings:
+
+<ruby>
+class C; end
+C.subclasses # => []
+
+Integer.subclasses # => ["Bignum", "Fixnum"]
+
+module M
+ class A; end
+ class B1 < A; end
+ class B2 < A; end
+end
+
+module N
+ class C < M::B1; end
+end
+
+M::A.subclasses # => ["N::C", "M::B2", "M::B1"]
+</ruby>
+
+The order in which these class names are returned is unspecified.
+
+See also +Object#subclasses_of+ in "Extensions to All Objects FIX THIS LINK":FIXME.
+
+WARNING: This method is redefined in some Rails core classes.
+
+NOTE: Defined in +active_support/core_ext/class/subclasses.rb+.
+
h3. Extensions to +String+
h4. Output Safety