Class: Algebrick::Matchers::AbstractLogic

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

Direct Known Subclasses

And, Or

Instance Attribute Summary collapse

Attributes inherited from Abstract

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

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

Methods included from TypeCheck

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

Constructor Details

#initialize(*matchers) ⇒ AbstractLogic

Returns a new instance of AbstractLogic.



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

def initialize(*matchers)
  @matchers = matchers.each { |m| matchable! m }
end

Instance Attribute Details

#matchersObject (readonly)

Returns the value of attribute matchers.



22
23
24
# File 'lib/algebrick/matchers/abstract_logic.rb', line 22

def matchers
  @matchers
end

Class Method Details

.call(*matchers) ⇒ Object



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

def self.call(*matchers)
  new *matchers
end

Instance Method Details

#==(other) ⇒ Object



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

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

#childrenObject



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

def children
  find_children matchers
end