D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Class
/
Filename :
subclasses-i.ri
back
Copy
U:RDoc::AnyMethod[iI"subclasses:ETI"Class#subclasses;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I";Returns an array of classes where the receiver is the ;FI"Bdirect superclass of the class, excluding singleton classes. ;FI"4The order of the returned array is not defined.;Fo:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"class A; end ;TI"class B < A; end ;TI"class C < B; end ;TI"class D < A; end ;TI" ;TI"$A.subclasses #=> [D, B] ;TI"!B.subclasses #=> [C] ;TI" C.subclasses #=> [] ;T:@format0o; ; [I"?Anonymous subclasses (not associated with a constant) are ;FI"returned, too:;F@o;; [I"c = Class.new(A) ;TI"BA.subclasses # => [#<Class:0x00007f003c77bd78>, D, B] ;T; 0o; ; [ I"ANote that the parent does not hold references to subclasses ;FI"Aand doesn't prevent them from being garbage collected. This ;FI"Ameans that the subclass might disappear when all references ;FI"to it are dropped:;F@o;; [I"G# drop the reference to subclass, it can be garbage-collected now ;TI" c = nil ;TI" ;TI"A.subclasses ;TI"# It can be ;TI"/# => [#<Class:0x00007f003c77bd78>, D, B] ;TI"# ...or just ;TI"# => [D, B] ;TI"8# ...depending on whether garbage collector was run;T; 0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"subclasses -> array ;F0[ I"();T@4FI" Class;TcRDoc::NormalClass00