Module: Uniword::ModelAttributeAccess
- Included in:
- Wordprocessingml::RunProperties
- Defined in:
- lib/uniword/model_attribute_access.rb
Overview
Model attribute access helpers for lutaml-model classes.
Provides read_attribute/write_attribute methods that call the public getters/setters generated by lutaml-model for declared attributes.
Validates that the attribute name exists in the model's schema before dispatching — unlike raw send() which bypasses visibility checks, this only accesses attributes that are part of the model's declared public API.
Instance Method Summary collapse
-
#read_attribute(name) ⇒ Object
Read a declared attribute's value by name.
-
#write_attribute(name, value) ⇒ Object
Write a declared attribute's value by name.
Instance Method Details
#read_attribute(name) ⇒ Object
Read a declared attribute's value by name.
16 17 18 |
# File 'lib/uniword/model_attribute_access.rb', line 16 def read_attribute(name) __send__(name) end |
#write_attribute(name, value) ⇒ Object
Write a declared attribute's value by name.
23 24 25 |
# File 'lib/uniword/model_attribute_access.rb', line 23 def write_attribute(name, value) __send__(:"#{name}=", value) end |