class Filigree::BasicPattern
This class provides the basis for all match patterns.
Public Instance Methods
<=>(other)
click to toggle source
Base implementation of bi-directional comparison for patterns.
@param [BasicPattern] other Right-hand side of the comparison
@return [Integer] Value corresponding to less than, equal to, or
greater than the right-hand side pattern.
# File lib/filigree/match.rb, line 302 def <=>(other) # This is performed in the non-intuitive order due to # higher-priority patterns having lower weights. other.weight - self.weight end
as(binding_pattern)
click to toggle source
Wraps this pattern in a {BindingPattern}, causing the object that this pattern matches to be bound to this name in the with block.
@param [BindingPattern] binding_pattern Binding pattern containing the name
# File lib/filigree/match.rb, line 312 def as(binding_pattern) binding_pattern.tap { |bp| bp.pattern_elem = self } end