Class: ConvenientService::Utils::Hash::TripleEqualityCompare
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Hash::TripleEqualityCompare
- Defined in:
- lib/convenient_service/utils/hash/triple_equality_compare.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#other_hash ⇒ Object
readonly
Returns the value of attribute other_hash.
Instance Method Summary collapse
- #call ⇒ Boolean
- #initialize(hash, other_hash) ⇒ void constructor
Methods inherited from Support::Command
Constructor Details
#initialize(hash, other_hash) ⇒ void
32 33 34 35 |
# File 'lib/convenient_service/utils/hash/triple_equality_compare.rb', line 32 def initialize(hash, other_hash) @hash = hash @other_hash = other_hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
19 20 21 |
# File 'lib/convenient_service/utils/hash/triple_equality_compare.rb', line 19 def hash @hash end |
#other_hash ⇒ Object (readonly)
Returns the value of attribute other_hash.
25 26 27 |
# File 'lib/convenient_service/utils/hash/triple_equality_compare.rb', line 25 def other_hash @other_hash end |
Instance Method Details
#call ⇒ Boolean
40 41 42 43 44 45 46 47 |
# File 'lib/convenient_service/utils/hash/triple_equality_compare.rb', line 40 def call return false if hash.size != other_hash.size return false if hash.keys.difference(other_hash.keys).any? return false unless hash.all? { |key, value| value === other_hash[key] } true end |