Matches anything that has a child matching the sub-expression
example:
s(s(s(s(s(:a))))) / s{ child(s(:a)) } #=> [s(s(s(s(s(:a))))), s(s(s(s(:a)))), s(s(s(:a))), s(s(:a)), s(:a)]
The child to match.
Create a Child matcher which will match anything
having a descendant matching child
.
# File lib/sexp.rb, line 1094 def initialize child @child = child end
Satisfied if matches child
or o
has a descendant
matching child
.
# File lib/sexp.rb, line 1102 def satisfy? o if child.satisfy? o true elsif o.kind_of? Sexp o.search_each(child).any? end end