class SexpPath::Matcher::All

See SexpQueryBuilder.all

Attributes

options[R]

Public Class Methods

new(*options) click to toggle source

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

# File lib/sexp_path/matcher/all.rb, line 6
def initialize(*options)
  @options = options
end

Public Instance Methods

inspect() click to toggle source
# File lib/sexp_path/matcher/all.rb, line 17
def inspect
  options.map{|o| o.inspect}.join(' & ')
end
satisfy?(o, data={}) click to toggle source

Satisfied when all sub expressions match o

# File lib/sexp_path/matcher/all.rb, line 11
def satisfy?(o, data={})
  return nil unless options.all?{|exp| exp.is_a?(Sexp) ? exp.satisfy?(o, data) : exp == o}

  capture_match o, data
end