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

sexp_type[R]

Public Class Methods

new(type) click to toggle source

Creates a Matcher which will match any Sexp who’s type is type, where a type is the first element in the Sexp.

# File lib/sexp_matcher.rb, line 904
def initialize type
  @sexp_type = type
end

Public Instance Methods

satisfy?(o) click to toggle source

Satisfied if the sexp_type of o is type.

# File lib/sexp_matcher.rb, line 915
def satisfy? o
  o.kind_of?(Sexp) && o.sexp_type == sexp_type
end