Class: Wood::TreePattern::OrMatcher
- Inherits:
-
Object
- Object
- Wood::TreePattern::OrMatcher
- Includes:
- CombinatorialMatching
- Defined in:
- lib/wood/tree_pattern/or_matcher.rb
Overview
Matches a [Node], if any of two given patterns match it.
Instance Method Summary collapse
- #==(node) ⇒ Object
- #===(node) ⇒ Object
-
#initialize(a, b) ⇒ OrMatcher
constructor
A new instance of OrMatcher.
- #inspect ⇒ Object
- #sexp ⇒ Object
Methods included from CombinatorialMatching
Constructor Details
#initialize(a, b) ⇒ OrMatcher
Returns a new instance of OrMatcher.
12 13 14 15 |
# File 'lib/wood/tree_pattern/or_matcher.rb', line 12 def initialize(a, b) @a = a @b = b end |
Instance Method Details
#==(node) ⇒ Object
21 22 23 |
# File 'lib/wood/tree_pattern/or_matcher.rb', line 21 def == node @a == node || @b == node end |
#===(node) ⇒ Object
17 18 19 |
# File 'lib/wood/tree_pattern/or_matcher.rb', line 17 def === node @a === node || @b === node end |
#inspect ⇒ Object
29 30 31 |
# File 'lib/wood/tree_pattern/or_matcher.rb', line 29 def inspect sexp.inspect end |
#sexp ⇒ Object
25 26 27 |
# File 'lib/wood/tree_pattern/or_matcher.rb', line 25 def sexp [:or_matcher, @a.sexp, @b.sexp] end |