The superclass of all classes. Defines the general behavior of objects.
Checks if self and other are equal. By default, has the same effect as equal?.
This method must be redefined with respect to each class's properties.
This method is mostly used for comparison within case statements. By default, acts like Object#==, but this behavior can be redefined in the subclass to implement an ownership check.
Returns the receiver class.
Creates a copy of the object. clone returns a complete clone of the original object, including freeze status and singleton methods, while dup duplicates the object contents only.
Note that clone and dup perform only a shallow copy. They duplicate the object itself, but nothing it points to (such as array elements).
For duplicated objects,
obj.equal?(obj.clone)
generally does not hold, while
obj == obj.clone
is correct in most cases.
Attempting to duplicate true, false, nil, Numeric objects, Symbol objects, and the like result in TypeError exceptions.
When other is self, returns true. This method must not be redefined.
Prohibits an object's contents from being modified. Modifying a frozen object throws a TypeError exception.
Returns true when the object's contents are prohibited from being modified.
Returns the object in a human-readable string format.
Returns true when self is a direct instance of the class klass. When obj.instance_of?(c) is true, obj.kind_of?(c) is always true as well.
Returns true when self is the class mod (or its subclass). or a class (or its subclass) that includes the module mod.
module M end class C < Object include M end class S < C end obj = S.new p obj.is_a? S # true p obj.is_a? M # true p obj.is_a? C # true p obj.is_a? Object # true p obj.is_a? Hash # false
Checks if the receiver is nil.
Returns a unique integer for each object. The integers are assigned to objects arbitrarily.
Called internally when an object's implicit conversion to an array is required.
Called internally when an object's implicit conversion to a hash is required.
Called internally when an object's implicit conversion to an integer is required.
Returns the string representation of the object. This method is used internally by print and sprintf.
When non-string objects are passed to arguments in print and sprintf, use this method to convert the objects to strings.
Called when an object's implicit conversion to a string is required.
The initialization method for user-defined classes. This method is called from Class#new to initialize a newly created object. The default behavior is to do nothing; it is assumed that this method will be redefined in the subclass as needed. The argument given to Class#new will be passed to initialize as is.
Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |