Ruby  3.4.0dev (2024-11-05 revision 348a53415339076afc4a02fcd09f3ae36e9c4c61)
Public Member Functions | Data Fields
RBasic Struct Reference

Ruby 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. More...
 

Data Fields

VALUE flags
 Per-object flags. More...
 
const VALUE klass
 Class of an object. More...
 

Detailed Description

Ruby object's base components.

All Ruby objects have them in common.

Definition at line 61 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 100 of file rbasic.h.

Field Documentation

◆ flags

VALUE RBasic::flags

Per-object flags.

Each Ruby object has its own characteristics apart from its class. 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 purposes. Back in the 1990s there were no such thing like _Alignas in C.

Definition at line 75 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 86 of file rbasic.h.

Referenced by rb_data_object_make().


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