Class: Crspec::Mock::ArgumentMatchers::HashExcluding
- Inherits:
-
Object
- Object
- Crspec::Mock::ArgumentMatchers::HashExcluding
- Defined in:
- lib/crspec/mock/argument_matchers.rb
Instance Method Summary collapse
- #===(actual) ⇒ Object (also: #==)
-
#initialize(expected) ⇒ HashExcluding
constructor
A new instance of HashExcluding.
- #inspect ⇒ Object
Constructor Details
#initialize(expected) ⇒ HashExcluding
Returns a new instance of HashExcluding.
30 31 32 |
# File 'lib/crspec/mock/argument_matchers.rb', line 30 def initialize(expected) @expected = expected end |
Instance Method Details
#===(actual) ⇒ Object Also known as: ==
34 35 36 37 38 |
# File 'lib/crspec/mock/argument_matchers.rb', line 34 def ===(actual) return false unless actual.is_a?(Hash) @expected.none? { |k, v| actual.key?(k) && (v == actual[k] || v === actual[k]) } end |
#inspect ⇒ Object
41 |
# File 'lib/crspec/mock/argument_matchers.rb', line 41 def inspect = "hash_excluding(#{@expected.inspect})" |