A library for defining and validating data structures.
Abstract module for handling heterogenous entity properties.
This module provides a base for accessing and mutating entity properties such as attributes and associations.
#==(other) =>
Compares the entity with the other object.
The other object must be an instance of the current class. In addition, the properties hashes of the two objects must be equal.
#[](property) => Object
Retrieves the property with the given key.
#[]=(property, value) => Object
Sets the given property to the given value.
#assign_properties(properties) => Object
Also known as:
assign
Updates the struct’s properties with the given values.
This method is used to update some (but not all) of the properties of the struct. For each key in the hash, it calls the corresponding writer method with the value for that property. If the value is nil, this will set the property value to the default for that property.
Any properties that are not in the given hash are unchanged.
If the properties hash includes any keys that do not correspond to an property, the struct will raise an error.
#initialize(**properties) => Object
#inspect => String
#inspect_with_options(**options) => String
#properties => Hash<String, Object>
Collects the entity properties.
#properties=(properties) => Object
Replaces the entity’s properties with the given values.
This method is used to update all of the properties of the entity. For each property, the writer method is called with the value from the hash, or nil if the corresponding key is not present in the hash. Any nil or missing values set the property value to that property’s default value, if any.
If the properties hash includes any keys that do not correspond to a valid property, the entity will raise an error.
#to_h => Hash<String, Object>
Returns a Hash representation of the entity.
Back to Documentation | Versions | 0.4 | Reference | Stannum | Stannum::Entities