Module Virtus::ValueObject::InstanceMethods
In: lib/virtus/value_object.rb

Methods

clone   dup   with  

Public Instance methods

ValueObjects are immutable and can‘t be cloned

They always represent the same value

@example

  value_object.clone === value_object # => true

@return [self]

@api public

dup()

Alias for clone

Create a new ValueObject by combining the passed attribute hash with the instances attributes.

@example

  number = PhoneNumber.new(kind: "mobile", number: "123-456-78-90")
  number.with(number: "987-654-32-10")
  # => #<PhoneNumber kind="mobile" number="987-654-32-10">

@return [Object]

@api public

[Validate]