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, #collect_assigns, #find_children, #inspect, #matchable!, #matched?, #to_a, #|

Methods included from TypeCheck

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

Constructor Details

- (Not) initialize(matcher)

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

- (Object) matcher (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

- (Object) ==(other)



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

- (Object) children



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

def children
  []
end

- (Boolean) matching?(other) (protected)

Returns:



39
40
41
# File 'lib/algebrick/matchers/not.rb', line 39

def matching?(other)
  not matcher === other
end

- (Object) to_s



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

def to_s
  '!' + matcher.to_s
end