class Sexp::Include
Matches an expression or any expression that includes the child.
examples:
s(:a, :b) / s{ include(:b) } #=> [s(:a, :b)] s(s(s(:a))) / s{ include(:a) } #=> [s(:a)]
Attributes
The value that should be included in the match.
Public Class Methods
Source
# File lib/sexp_matcher.rb, line 948 def initialize value @value = value end
Creates a Matcher
which will match any Sexp that contains the value
.
Public Instance Methods
Source
# File lib/sexp_matcher.rb, line 956 def satisfy? o Sexp === o && o.any? { |c| # TODO: switch to respond_to?? Sexp === value ? value.satisfy?(c) : value == c } end
Satisfied if a o
is a Sexp and one of o
‘s elements matches value