Module: Kirei::Domain::ValueObject

Extended by:
T::Helpers, T::Sig
Defined in:
lib/kirei/domain/value_object.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/kirei/domain/value_object.rb', line 14

def ==(other)
  return false unless instance_of?(other.class)

  instance_variables.all? do |var|
    instance_variable_get(var) == other.instance_variable_get(var)
  end
end

#classObject

rubocop:disable all



11
# File 'lib/kirei/domain/value_object.rb', line 11

def class; super; end

#equal_with_array_mode?(other, array_mode: Kirei::Services::ArrayComparison::Mode::STRICT) ⇒ Boolean



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/kirei/domain/value_object.rb', line 28

def equal_with_array_mode?(other, array_mode: Kirei::Services::ArrayComparison::Mode::STRICT)
  return false unless instance_of?(other.class)

  instance_variables.all? do |var|
    one = instance_variable_get(var)
    two = other.instance_variable_get(var)
    next one == two unless one.is_a?(Array)

    Kirei::Services::ArrayComparison.call(one, two, mode: array_mode)
  end
end