class SexpPath::Matcher::Pattern
See SexpQueryBuilder.m
Attributes
pattern[R]
Public Class Methods
new(pattern)
click to toggle source
Create a Patten matcher which will match any atom that either matches the input pattern
.
# File lib/sexp_path/matcher/pattern.rb, line 6 def initialize(pattern) @pattern = pattern end
Public Instance Methods
inspect()
click to toggle source
# File lib/sexp_path/matcher/pattern.rb, line 17 def inspect "m(#{pattern.inspect})" end
satisfy?(o, data={})
click to toggle source
Satisfied if o
is an atom, and o
matches pattern
# File lib/sexp_path/matcher/pattern.rb, line 11 def satisfy?(o, data={}) return nil unless !o.is_a?(Sexp) && o.to_s =~ pattern capture_match o, data end