Module: Virtus::ValueObject::InstanceMethods
- Defined in:
- lib/virtus/value_object.rb
Instance Method Summary collapse
-
#clone ⇒ self
(also: #dup)
ValueObjects are immutable and can’t be cloned.
-
#with(attribute_updates) ⇒ Object
Create a new ValueObject by combining the passed attribute hash with the instances attributes.
Instance Method Details
#clone ⇒ self Also known as: dup
ValueObjects are immutable and can’t be cloned
They always represent the same value
60 61 62 |
# File 'lib/virtus/value_object.rb', line 60 def clone self end |
#with(attribute_updates) ⇒ Object
Create a new ValueObject by combining the passed attribute hash with the instances attributes.
77 78 79 |
# File 'lib/virtus/value_object.rb', line 77 def with(attribute_updates) self.class.new(attribute_set.get(self).merge(attribute_updates)) end |