Module: Isomorphic::Node::Internal::DeepEquals

Extended by:
ActiveSupport::Concern
Included in:
AbstractNode
Defined in:
lib/isomorphic/node.rb

Overview

Included when the base class needs to perform deep equality testing.

Instance Method Summary collapse

Instance Method Details

#all_attributes_eql?(base, object, attributes = ::ActiveSupport::HashWithIndifferentAccess.new) ⇒ Boolean

Are all attributes deep equal for the given object?

Parameters:

  • base (Module)

    the base module

  • object (Object)

    the object

  • attributes (ActiveSupport::HashWithIndifferentAccess) (defaults to: ::ActiveSupport::HashWithIndifferentAccess.new)

    the attributes

Returns:

  • (Boolean)

    true if all attribues are deep equal; otherwise, false



76
77
78
79
80
81
82
83
84
# File 'lib/isomorphic/node.rb', line 76

def all_attributes_eql?(base, object, attributes = ::ActiveSupport::HashWithIndifferentAccess.new)
  attributes.try(:each_pair) do |pair|
    attribute_name, expected_value = *pair

    return false unless deep_eql?(base, expected_value, object.send(attribute_name))
  end

  true
end