Module: Taro::Types::Shared::Equivalence

Defined in:
lib/taro/types/shared/equivalence.rb

Instance Method Summary collapse

Instance Method Details

#equal_properties?(other) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
# File 'lib/taro/types/shared/equivalence.rb', line 6

def equal_properties?(other)
  return false unless other.openapi_type == openapi_type

  # @fields is lazy-loaded. Comparing @field_defs suffices.
  ignored = %i[@fields]
  props = instance_variables - ignored
  props == (other.instance_variables - ignored) &&
    props.all? { |p| instance_variable_get(p) == other.instance_variable_get(p) }
end

#equivalent?(other) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/taro/types/shared/equivalence.rb', line 2

def equivalent?(other)
  equal?(other) || equal_properties?(other)
end