Class: Sexp
Overview
SexpPath extends Sexp with Traverse. This adds support for searching S-Expressions
Direct Known Subclasses
Instance Method Summary collapse
-
#satisfy?(o, data = {}) ⇒ Boolean
Extends Sexp to allow any Sexp to be used as a SexpPath matcher.
Methods included from SexpPath::Traverse
#capture_as, #replace_sexp, #search, #search_each
Instance Method Details
#satisfy?(o, data = {}) ⇒ Boolean
Extends Sexp to allow any Sexp to be used as a SexpPath matcher
55 56 57 58 59 60 61 |
# File 'lib/sexp_path.rb', line 55 def satisfy?(o, data={}) return false unless o.is_a? Sexp return false unless (length == o.length || last.is_a?(SexpPath::Matcher::Remaining) ) each_with_index{|c,i| return false unless c.is_a?(Sexp) ? c.satisfy?( o[i], data ) : c == o[i] } capture_match(o, data) end |