class Sexp::Child
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)]
Attributes
The child to match.
Public Class Methods
Source
# File lib/sexp_matcher.rb, line 754 def initialize child @child = child end
Create a Child
matcher which will match anything having a descendant matching child
.
Public Instance Methods
Source
# File lib/sexp_matcher.rb, line 762 def satisfy? o child.satisfy?(o) || (o.kind_of?(Sexp) && o.search_each(child).any?) end
Satisfied if matches child
or o
has a descendant matching child
.