Class: Algebrick::Matchers::Not

Inherits:
Abstract show all
Defined in:
lib/algebrick/matchers/not.rb

Instance Attribute Summary collapse

Attributes inherited from Abstract

#value

Instance Method Summary collapse

Methods inherited from Abstract

#!, #&, #===, #>, #assign!, #assign?, #assign_to_s, #assigned?, #assigns, #case, #children_including_self, #inspect, #matched?, #to_a, #|

Methods included from TypeCheck

#Child!, #Child?, #Match!, #Match?, #Type!, #Type?

Constructor Details

#initialize(matcher) ⇒ Not

Returns a new instance of Not.



20
21
22
# File 'lib/algebrick/matchers/not.rb', line 20

def initialize(matcher)
  @matcher = matcher
end

Instance Attribute Details

#matcherObject (readonly)

Returns the value of attribute matcher.



18
19
20
# File 'lib/algebrick/matchers/not.rb', line 18

def matcher
  @matcher
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
35
# File 'lib/algebrick/matchers/not.rb', line 32

def ==(other)
  other.kind_of? self.class and
      self.matcher == other.matcher
end

#childrenObject



24
25
26
# File 'lib/algebrick/matchers/not.rb', line 24

def children
  []
end

#to_sObject



28
29
30
# File 'lib/algebrick/matchers/not.rb', line 28

def to_s
  '!' + matcher.to_s
end