klassemetoder
|
inherited
|
aClass.inherited( aSubClass )
|
|
This is a singleton method (per class) invoked by Ruby when a subclass
of aClass is created. The new subclass is passed as a
parameter.
class Top
def Top.inherited(sub)
print "New subclass: ", sub, "\n"
end
end
class Middle < Top
end
class Bottom < Middle
end
|
produces:
New subclass: Middle
New subclass: Bottom
|
|
new
|
Class.new( aSuperClass=Object )
-> aClass
|
|
Creates a new anonymous (unnamed)
class with the given superclass (or
Object if no parameter is given).
|
instansmetoder
|
new
|
aClass.new( [
args
]*
)
-> anObject
|
|
Creates a new object of aClass's class, then invokes that object's
initialize method, passing it args.
|
superclass
|
aClass.superclass
-> aSuperClass or nil
|
|
Returns the superclass of aClass, or nil .
Class.superclass
|
» |
Module
|
Object.superclass
|
» |
nil
|
|