Ruby: RBasic Struct Reference

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

Public Member Functions | Data Fields
RBasic Struct Reference

Ruby's object's, base components. More...

`#include <rbasic.h>`

## Public Member Functions
| RBasic ()
| We need to define this explicit constructor because the field `klass` is const-qualified above, which effectively defines the implicit default constructor as "deleted" (as of C++11) – No way but to define one by ourselves.

## Data Fields
VALUE | flags
| Per-object flags.
const VALUE | klass
| Class of an object.

## Detailed Description

Ruby's object's, base components.

Every single ruby objects have them in common.

Definition at line 62 of file rbasic.h.

## Constructor & Destructor Documentation

## ◆ RBasic()

RBasic::RBasic | ( |  | ) |
| inline

We need to define this explicit constructor because the field `klass` is const-qualified above, which effectively defines the implicit default constructor as "deleted" (as of C++11) – No way but to define one by ourselves.

Definition at line 102 of file rbasic.h.

## Field Documentation

## ◆ flags

VALUE RBasic::flags

Per-object flags.

Each ruby objects have their own characteristics apart from their classes. For instance whether an object is frozen or not is not controlled by its class. This is where such properties are stored.

See also
  enum ruby_fl_type

Note
  This is VALUE rather than an enum for alignment purpose. Back in the 1990s there were no such thing like `_Alignas` in C.

Definition at line 77 of file rbasic.h.

## ◆ klass

const VALUE RBasic::klass

Class of an object.

Every object has its class. Also, everything is an object in Ruby. This means classes are also objects. Classes have their own classes, classes of classes have their classes, too ... and it recursively continues forever.

Also note the `const` qualifier. In ruby an object cannot "change" its class.

Definition at line 88 of file rbasic.h.

Referenced by rb_data_object_alloc(), rb_data_object_make(), rb_data_typed_object_alloc(), and rb_data_typed_object_make().

The documentation for this struct was generated from the following file:

- include/ruby/internal/core/rbasic.h