Website hosting service by

 Back to Index

prev - up - next - index


The super class of all the Ruby class hierarchy.




self == other

Checks if two objects are equal. The default definition in the Kernel class checks by object ID. It should be redefined in subclasses according to the characteristic of the class.


Returns the copy of the object. For cloned object,

obj == obj.clone

is always true, though


is false most of the time.

the dup method is defined as:

def dup

clone and dup copy the receiver, but they do not copy the objects pointed by the receiver (i.e shallow copy).


Prints self to the port. The port's default value is $>.

def display(out=$>)
  out.print self
public :display

Checks if two objects are equal. This method is used by Hash to compare whether two keys are same. When this method is redefined, the hash method should be updated.

The default definition of the method eql? is like blow:

def eql?(other)
  self == other


Checks if two objects have same object ID. This method should not be redefined in the subclass.

self =~ other

Method for old style match like obj =~ /RE/. The default definitions is `=='.

self === other

This method is used to compare in case. The default definitions is `=='.


Extends self by adding methods defined in modules as singleton-methods.


Returns the integer hash value of the object. It is used in the Hash class to calculate the holding place of an object. The hash value of two objects must be equal, where these two objects are equal by using eql? operator. So, whenever you redefine the definition of the eql? operator in any class, don't forget to redefine hash method according to the definition.


Returns the unique integer value for each object.


Returns the human-readable string representation of the receiver.


The initialize method for the user-defined classes. This method will be called from Class#new to initialize the newly created object. The default behavior is to do nothing. It is assumed that this method will be redefined in the subclasses. The argument to Class#new will be passed to the initialize

the method named initialize automatically falls under private visibility.


Evaluates the expr string in the object context. If block supplied for the method, the block is evaluated under the receiver's context. This allows to avoid compiling the string everytime.

In instance_eval's context, self is bound to the object, so that instance variables and methods of the receiver are accessed.


Returns true, if self is an instance of the specified class. It is always true, when obj.kind_of?(c) is true.


Returns the array of self's instance variable names.


Returns true, if self is an instance of the specified class, or its subclass.

method_missing(msg_id, ...)

Will be called when the specified method is not defined for the receiver. The first argument, msg_id is the method name as a symbol. The second and later arguments are the arguments given to the undefined method, if any.


Returns the array of the public method names which defined in the receiver.


Checks whether the receiver is nil or not.


Returns the array of the private method names which defined in the receiver.


Removes specified instance variable from the object. It does not raise any exception even if the object does not have named instance variable.


Returns true if the receiver has the public method named mesg. Mesg must be the symbol fixnum or the string. It returns true for private methods, if the optional argument priv given, and its value is true,

send(symbol[, args...])

calls the method specified by the symbol, with args.


Will be called when the singleton method defined for the receiver.


Returns the array of the singleton method names which defined in the receiver.


Turns on `taint mark' of the object.


Returns true if the string is `tainted'.


Returns the string representation of the self. This method is used internally by print and sprintf.


Converts the self into an array. Returns an array of 1 element contains self for classes would not be converted into an array naturally.


Returns the receiver's class.


Turns off `taint mark' of the object. Programmers should be responsible for the security issue caused by removing the taint mark. The mark can't be removed if the security level ($SAFE) is greater than or equals to level 3.

prev - up - next - index





2002-2004 Website Hosting Service

Buy domain name at only $5.95/yr with comprehensive domain hosting services. Domain registration and domain search service from $5.95 Cheap domain name registration and domain transfer service

Disclaimer: This documentation is provided only for the benefits of our website hosting customers.
For authoritative source of the documentation, please refer to