Class: Punchout::Matcher::Ancestry

Inherits:
Object
  • Object
show all
Includes:
Punchout::Matcher
Defined in:
lib/punchout/matcher/ancestry.rb

Overview

Matches when the candidate’s class matches the subject class of this matcher, or any ancestor of that subject.

‘Matcher::Ancestry.new([]).matches?(Enumerable) => true`

Instance Method Summary collapse

Methods included from Punchout::Matcher

#conflicts?, #initialize, #punches

Instance Method Details

#matches?(candidate) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/punchout/matcher/ancestry.rb', line 13

def matches?(candidate)
  (@subject >= candidate.class) == true
end