Module: Punchout::Matcher

Included in:
Ancestry, Equal, Klass, Progeny
Defined in:
lib/punchout/matcher.rb,
lib/punchout/matcher/class.rb,
lib/punchout/matcher/equal.rb,
lib/punchout/matcher/progeny.rb,
lib/punchout/matcher/ancestry.rb

Overview

When a user calls Punchable#punch with a ‘candidate`, each Matchable will call Matcher#matches? until one returns true.

Defined Under Namespace

Classes: Ancestry, Equal, Klass, Progeny

Instance Method Summary collapse

Instance Method Details

#conflicts?(other) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/punchout/matcher.rb', line 16

def conflicts?(other)
  false
end

#initialize(subject) ⇒ Object



6
7
8
# File 'lib/punchout/matcher.rb', line 6

def initialize(subject)
  @subject = subject
end

#punches(thing) ⇒ Object

Creates a Matchable assocating this matcher with the thing it should return.



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

def punches(thing)
  Punchout::Puncher::Matchable.new(self, thing)
end