Class: Algebrick::Matchers::Any
- Defined in:
- lib/algebrick/matchers/any.rb
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
- #==(other) ⇒ Object
- #children ⇒ Object
-
#to_a ⇒ Object
transforms *any to many.
- #to_s ⇒ Object
Methods inherited from Abstract
#!, #&, #===, #>, #assign!, #assign?, #assign_to_s, #assigned?, #assigns, #case, #children_including_self, #initialize, #inspect, #matched?, #|
Methods included from TypeCheck
#Child!, #Child?, #Match!, #Match?, #Type!, #Type?
Constructor Details
This class inherits a constructor from Algebrick::Matchers::Abstract
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/algebrick/matchers/any.rb', line 26 def ==(other) other.kind_of? self.class end |
#children ⇒ Object
18 19 20 |
# File 'lib/algebrick/matchers/any.rb', line 18 def children [] end |
#to_a ⇒ Object
transforms *any to many
31 32 33 34 35 36 37 |
# File 'lib/algebrick/matchers/any.rb', line 31 def to_a if assigned? super else [Matchers::Many.new.tap { |m| m.assign! if assign? }] end end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/algebrick/matchers/any.rb', line 22 def to_s assign_to_s + 'any' end |