aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/active_support_overview.textile
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2009-05-31 15:52:16 +0200
committerXavier Noria <fxn@hashref.com>2009-05-31 15:52:16 +0200
commitd610295cf3bea55d88db44fe573ca35cd5728a34 (patch)
tree66a2420cbda9eb33f907752d9c1eb671b2851a5c /railties/guides/source/active_support_overview.textile
parent370cdd2d80a0700065af5996389ef6a81cad1184 (diff)
downloadrails-d610295cf3bea55d88db44fe573ca35cd5728a34.tar.gz
rails-d610295cf3bea55d88db44fe573ca35cd5728a34.tar.bz2
rails-d610295cf3bea55d88db44fe573ca35cd5728a34.zip
AS guide: explains Class#subclasses
Diffstat (limited to 'railties/guides/source/active_support_overview.textile')
-rw-r--r--railties/guides/source/active_support_overview.textile34
1 files changed, 30 insertions, 4 deletions
diff --git a/railties/guides/source/active_support_overview.textile b/railties/guides/source/active_support_overview.textile
index 4b3e533e7a..659e4cdd50 100644
--- a/railties/guides/source/active_support_overview.textile
+++ b/railties/guides/source/active_support_overview.textile
@@ -9,13 +9,11 @@ By referring to this guide you will learn:
endprologue.
-h3. Extensions to +Kernel+
+h3. Extensions to All Objects
-...
+h4. +blank?+ and +present?+
-h3. Extensions to +Object+
-...
h3. Extensions to +Module+
@@ -108,6 +106,34 @@ end
If for whatever reason an application loads the definition of a mailer class and after that sets +ActionMailer::Base.delivery_method+, the mailer class will still see the new value. In addition, the mailer class is able to change the +delivery_method+ without affecting the value in the parent using its own inherited class attribute writer.
+h4. Descendants
+
+The method +Class#subclasses+ returns the names of all subclasses of a given class as an array of strings. That comprises not only direct subclasses, but all descendants down the hierarchy:
+
+<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 unespecified.
+
+See also +Object#subclasses_of+ in "Extensions to All Objects FIX THIS LINK":FIXME.
+
+
h3. Extensions to +NilClass+
...