class SexpPath::Matcher::Any

See SexpQueryBuilder.any

Attributes

options[R]

Public Class Methods

new(*options) click to toggle source

Create an Any matcher which will match any of the options.

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

Public Instance Methods

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

Satisfied when any sub expressions match o

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

  capture_match o, data
end