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
| Name | Description |
|---|---|
[] | Accesses an attribute using bracket notation. |
Members
| Name | Description |
|---|---|
| get_attr | Gets the value of the specified attribute. |
| get_attrs | Returns all attributes of the dynamic object. |
| get_type_name | Returns the type name of the dynamic object. |
| has_attr | Checks if the dynamic object has the specified attribute. |
| is_explicit | Checks if the dynamic object is explicit. |
| method_missing | Handles missing method calls on the dynamic object. |
| set_explicit | Sets whether the dynamic object is explicit. |