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 through the model's public method table — only attributes that are part of the model's declared public API can be accessed.
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.
17 18 19 20 |
# File 'lib/uniword/model_attribute_access.rb', line 17 def read_attribute(name) validate_declared_attribute!(name) method(name).call end |
#write_attribute(name, value) ⇒ Object
Write a declared attribute's value by name.
26 27 28 29 |
# File 'lib/uniword/model_attribute_access.rb', line 26 def write_attribute(name, value) validate_declared_attribute!(name) method(:"#{name}=").call(value) end |