class Sequent::Core::ValueObject
ValueObject
is a container for data that belongs together but requires no identity
If something requires identity is up to you to decide. An example in for instance the invoicing domain could be a person’s Address.
class Address < Sequent::Core::ValueObject attrs street: String, city: String, country: Country end
A ValueObject
is equal to another ValueObject
if and only if all attrs
are equal.
You can copy a valueobject as follows:
new_address = address.copy(street: "New Street")
This a deep clone of the address with the street attribute containing “New Street”
Private Class Methods
Source
# File lib/sequent/core/value_object.rb, line 38 def initialize(args = {}) update_all_attributes args end