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

Methods included from TypeCheck

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

Constructor Details

- (AbstractLogic) initialize(*matchers)

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

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

+ (Object) call(*matchers)



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

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

Instance Method Details

- (Object) ==(other)



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

- (Object) children



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

def children
  find_children matchers
end