> For the complete documentation index, see [llms.txt](https://enls.gitbook.io/rgss-reference-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enls.gitbook.io/rgss-reference-manual/standard-library/built-in-classes/object.md).

# Object

The superclass of all classes. Defines the general behavior of objects.

self == other

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.

self === other

This method is mostly used for comparison within case statements. By default, acts like [Object#==](broken://pages/CRJQQLH3HHPIxlNFG00m), but this behavior can be redefined in the subclass to implement an ownership check.

class

Returns the receiver class.

clonedup

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.

equal?(other)

When other is self, returns true. This method must not be redefined.

freeze

Prohibits an object's contents from being modified. Modifying a frozen object throws a TypeError exception.

frozen?

Returns true when the object's contents are prohibited from being modified.

inspect

Returns the object in a human-readable string format.

instance\_of?(klass)

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.

is\_a?(mod)kind\_of?(mod)

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
```

nil?

Checks if the receiver is nil.

object\_id

Returns a unique integer for each object. The integers are assigned to objects arbitrarily.

to\_ary

Called internally when an object's implicit conversion to an array is required.

to\_hash

Called internally when an object's implicit conversion to a hash is required.

to\_int

Called internally when an object's implicit conversion to an integer is required.

to\_s

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.

to\_str

Called when an object's implicit conversion to a string is required.
