U:RDoc::NormalClass[iI"
Class:ET@I"Module;To:RDoc::Markup::Document:@parts[o;;[ :
@fileI"class.c;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[I";Extends any Class to include _json_creatable?_ method.;T; I" ext/json/lib/json/common.rb;T;
0o;;[o;;[I"FClasses in Ruby are first-class objects---each is an instance of ;TI"class Class
.;To:RDoc::Markup::BlankLine o;;[I"0Typically, you create a new class by using:;T@o:RDoc::Markup::Verbatim;[I"class Name
;TI"0 # some code describing the class behavior
;TI" end
;T:@format0o;;[I"MWhen a new class is created, an object of type Class is initialized and ;TI"Dassigned to a global constant (Name
in this case).;T@o;;[ I"FWhen Name.new
is called to create a new object, the ;TI"Fnew
method in Class
is run by default. ;TI"@This can be demonstrated by overriding new
in ;TI"Class
:;T@o;
;[I"class Class
;TI" alias old_new new
;TI" def new(*args)
;TI"2 print "Creating a new ", self.name, "\n"
;TI" old_new(*args)
;TI" end
;TI" end
;TI"
;TI"class Name
;TI" end
;TI"
;TI"n = Name.new
;T;0o;;[I"produces:;T@o;
;[I"Creating a new Name
;T;0o;;[ I"DClasses, modules, and objects are interrelated. In the diagram ;TI"Fthat follows, the vertical arrows represent inheritance, and the ;TI"(BasicObject)-------|-...
;TI"8 ^ | ^ |
;TI"8 | | | |
;TI"< Object---------|----->(Object)---------|-...
;TI"8 ^ | ^ |
;TI"8 | | | |
;TI"8 +-------+ | +--------+ |
;TI"8 | | | | | |
;TI"< | Module-|---------|--->(Module)-|-...
;TI"8 | ^ | | ^ |
;TI"8 | | | | | |
;TI"< | Class-|---------|---->(Class)-|-...
;TI"8 | ^ | | ^ |
;TI"8 | +---+ | +----+
;TI"* | |
;TI";obj--->OtherClass---------->(OtherClass)-----------...;T;0; I"
object.c;T;
0; 0;
0[ [ [ [[I"
class;T[[:public[[I"new;TI"
object.c;T[:protected[ [:private[ [I"
instance;T[[;[ [I"
allocate;T@g[I"json_creatable?;FI" ext/json/lib/json/common.rb;T[I"new;T@g[I"superclass;T@g[;[ [;[[I"inherited;T@g[ [U:RDoc::Context::Section[i 0o;;[ ; 0;
0[@
@@[@[cRDoc::TopLevel