class Sexp::Type
Matches anything having the same sexp_type
, which is the first value in a Sexp.
examples:
s(:a, :b) / s{ t(:a) } #=> [s(:a, :b)] s(:a, :b) / s{ t(:b) } #=> [] s(:a, s(:b, :c)) / s{ t(:b) } #=> [s(:b, :c)]
Attributes
Public Class Methods
Source
# File lib/sexp_matcher.rb, line 904 def initialize type @sexp_type = type end
Creates a Matcher
which will match any Sexp who’s type is type
, where a type is the first element in the Sexp.
Public Instance Methods
Source
# File lib/sexp_matcher.rb, line 915 def satisfy? o o.kind_of?(Sexp) && o.sexp_type == sexp_type end
Satisfied if the sexp_type
of o
is type
.