class Sexp::Not

Matches when sub-expression does not match.

This is also available via Matcher#-@.

examples:

s(:a) / s{ not?(s(:b)) } #=> [s(:a)]
s(:a) / s{ -s(:b) }      #=> [s(:a)]
s(:a) / s{ s(not? :a) } #=> []

Attributes

value[R]

The value to negate in the match.

Public Class Methods

new(value) click to toggle source

Creates a Matcher which will match any Sexp that does not match the value

# File lib/sexp.rb, line 1047
def initialize value
  @value = value
end

Public Instance Methods

satisfy?(o) click to toggle source

Satisfied if a o does not match the value

# File lib/sexp.rb, line 1058
def satisfy? o
  !(value.kind_of?(Sexp) ? value.satisfy?(o) : value == o)
end