Class: Filigree::BasicPattern
Overview
This class provides the basis for all match patterns.
Direct Known Subclasses
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Base implementation of bi-directional comparison for patterns.
-
#as(binding_pattern) ⇒ Object
Wraps this pattern in a BindingPattern, causing the object that this pattern matches to be bound to this name in the with block.
Methods included from AbstractClass
abstract_method, extended, install_icvars, new
Instance Method Details
#<=>(other) ⇒ Integer
Base implementation of bi-directional comparison for patterns.
304 305 306 |
# File 'lib/filigree/match.rb', line 304 def <=>(other) self.weight - other.weight end |
#as(binding_pattern) ⇒ Object
Wraps this pattern in a Filigree::BindingPattern, causing the object that this pattern matches to be bound to this name in the with block.
312 313 314 |
# File 'lib/filigree/match.rb', line 312 def as(binding_pattern) binding_pattern.tap { |bp| bp.pattern_elem = self } end |