class Sexp::Any
Matches when any of the sub-expressions match.
This is also available via Matcher#|
.
examples:
s(:a) / s{ any(s(:a), s(:b)) } #=> [s(:a)] s(:a) / s{ s(:a) | s(:b) } #=> [s(:a)] # same thing via | s(:a) / s{ any(s(:b), s(:c)) } #=> []
Attributes
The collection of sub-matchers to match against.
Public Class Methods
Source
# File lib/sexp_matcher.rb, line 607 def initialize *options @options = options end
Create an Any
matcher which will match any of the options
.
Public Instance Methods
Source
# File lib/sexp_matcher.rb, line 614 def satisfy? o options.any? { |exp| Sexp === exp && exp.satisfy?(o) || exp == o } end
Satisfied when any sub expressions match o