D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
BasicObject
/
Filename :
cdesc-BasicObject.ri
back
Copy
U:RDoc::NormalClass[iI"BasicObject:ET@0o:RDoc::Markup::Document:@parts[o;;[ : @fileI"class.c;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[I"?+BasicObject+ is the parent class of all classes in Ruby. ;TI"GIn particular, +BasicObject+ is the parent class of class Object, ;TI"Bwhich is itself the default parent class of every Ruby class:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim;[I"class Foo; end ;TI"#Foo.superclass # => Object ;TI"(Object.superclass # => BasicObject ;T:@format0o;;[I"8+BasicObject+ is the only class that has no parent:;T@o; ;[I"%BasicObject.superclass # => nil ;T;0o;;[I"D\Class +BasicObject+ can be used to create an object hierarchy ;TI"M(e.g., class Delegator) that is independent of Ruby's object hierarchy. ;TI"Such objects:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o;;[I"=Do not have namespace "pollution" from the many methods ;TI"=provided in class Object and its included module Kernel.;To;;0;[o;;[I"0Do not have definitions of common classes, ;TI"Fand so references to such common classes must be fully qualified ;TI" (+::String+, not +String+).;T@o;;[I"DA variety of strategies can be used to provide useful portions ;TI"<of the Standard Library in subclasses of +BasicObject+:;T@o;;;;[o;;0;[o;;[I";The immediate subclass could <tt>include Kernel</tt>, ;TI"<which would define methods such as +puts+, +exit+, etc.;To;;0;[o;;[I"?A custom Kernel-like module could be created and included.;To;;0;[o;;[I"0Delegation can be used via #method_missing:;T@o; ;[I"(class MyObjectSystem < BasicObject ;TI" DELEGATE = [:puts, :p] ;TI" ;TI"/ def method_missing(name, *args, &block) ;TI"4 return super unless DELEGATE.include? name ;TI", ::Kernel.send(name, *args, &block) ;TI" end ;TI" ;TI"> def respond_to_missing?(name, include_private = false) ;TI"! DELEGATE.include?(name) ;TI" end ;TI" end ;T;0S:RDoc::Markup::Heading: leveli: textI"What's Here;T@o;;[I"4These are the methods defined for \BasicObject:;T@o;;;;[o;;0;[o;;[I"0::new: Returns a new \BasicObject instance.;To;;0;[o;;[I"C#!: Returns the boolean negation of +self+: +true+ or +false+.;To;;0;[o;;[I"F#!=: Returns whether +self+ and the given object are _not_ equal.;To;;0;[o;;[I"E#==: Returns whether +self+ and the given object are equivalent.;To;;0;[o;;[I"?#__id__: Returns the integer object identifier for +self+.;To;;0;[o;;[I"@#__send__: Calls the method identified by the given symbol.;To;;0;[o;;[I"N#equal?: Returns whether +self+ and the given object are the same object.;To;;0;[o;;[I"R#instance_eval: Evaluates the given string or block in the context of +self+.;To;;0;[o;;[I"d#instance_exec: Executes the given block in the context of +self+, passing the given arguments.;To;;0;[o;;[I"T#method_missing: Called when +self+ is called with a method it does not define.;To;;0;[o;;[I"P#singleton_method_added: Called when a singleton method is added to +self+.;To;;0;[o;;[I"V#singleton_method_removed: Called when a singleton method is removed from +self+.;To;;0;[o;;[I"X#singleton_method_undefined: Called when a singleton method is undefined in +self+.;T; I" object.c;T; 0; 0; 0[ [ [ [[I" class;T[[:public[[I"new;TI" object.c;T[:protected[ [:private[ [I" instance;T[[;[ [I"!;T@�[I"!=;T@�[I"==;T@�[I"__id__;TI" gc.c;T[I" __send__;TI"vm_eval.c;T[I"equal?;T@�[I"instance_eval;T@�[I"instance_exec;T@�[;[ [;[ [I"method_missing;T@�[I"singleton_method_added;T@�[I"singleton_method_removed;T@�[I"singleton_method_undefined;T@�[ [U:RDoc::Context::Section[i 0o;;[ ; 0; 0[ @I" gc.c;T@�I"vm_eval.c;T@�cRDoc::TopLevel