Class: Minicrest::HashEntryMatcher Private

Inherits:
Matcher
  • Object
show all
Defined in:
lib/minicrest/hash_entry_matchers.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Base class for matchers that check entries in a Hash.

Direct Known Subclasses

AllEntries, NoEntry, SomeEntry

Instance Method Summary collapse

Methods inherited from Matcher

#&, #description, #failure_message, #matches?, #negated_failure_message, #|

Constructor Details

#initialize(entry_matcher) ⇒ HashEntryMatcher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new hash entry matcher.

Parameters:

  • entry_matcher (Proc, Matcher)

    a proc or matcher that receives (key, value)



13
14
15
16
# File 'lib/minicrest/hash_entry_matchers.rb', line 13

def initialize(entry_matcher)
  super()
  @entry_matcher = entry_matcher
end

Instance Method Details

#hash?(actual) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Checks if actual is a Hash.

Parameters:

  • actual (Object)

    the value to check

Returns:

  • (Boolean)

    true if actual is a Hash



22
23
24
# File 'lib/minicrest/hash_entry_matchers.rb', line 22

def hash?(actual)
  actual.is_a?(Hash)
end