Skip to main content

DynamicObject

A flexible object type that allows dynamic creation and modification of attributes at runtime.

DynamicObject provides a way to create objects with attributes that can be added, modified, or accessed dynamically without predefined structure. It supports method_missing for handling undefined method calls and can be used to implement prototype-based programming patterns or create flexible data containers.

Constructors

DynamicObject() -> DynamicObject

Constructs a default dynamic object.

DynamicObject(const string type_name) -> DynamicObject

Constructs a dynamic object with the specified type name.

Parameters

  • type_name: The name of the type for the dynamic object.

Symbols

NameDescription
[]Accesses an attribute using bracket notation.

Members

NameDescription
get_attrGets the value of the specified attribute.
get_attrsReturns all attributes of the dynamic object.
get_type_nameReturns the type name of the dynamic object.
has_attrChecks if the dynamic object has the specified attribute.
is_explicitChecks if the dynamic object is explicit.
method_missingHandles missing method calls on the dynamic object.
set_explicitSets whether the dynamic object is explicit.