class Sexp::All

Matches only when all sub-expressions match.

This is also available via Matcher#&.

examples:

s(:a)     / s{ all(s(:a), s(:b)) }    #=> []
s(:a, :b) / s{ t(:a) & include(:b)) } #=> [s(:a, :b)]

Attributes

options[R]

The collection of sub-matchers to match against.

Public Class Methods

new(*options) click to toggle source

Create an All matcher which will match all of the options.

# File lib/sexp_matcher.rb, line 656
def initialize *options
  @options = options
end

Public Instance Methods

satisfy?(o) click to toggle source

Satisfied when all sub expressions match o

# File lib/sexp_matcher.rb, line 663
def satisfy? o
  options.all? { |exp|
    exp.kind_of?(Sexp) ? exp.satisfy?(o) : exp == o
  }
end