Class: Filigree::LiteralPattern

Inherits:
SingleObjectPattern show all
Defined in:
lib/filigree/match.rb

Overview

A pattern that forces an equality comparison

Instance Attribute Summary

Attributes inherited from SingleObjectPattern

#pattern_elem

Instance Method Summary collapse

Methods inherited from SingleObjectPattern

#initialize

Methods included from AbstractClass

#abstract_method, extended, #install_icvars, #new

Methods inherited from BasicPattern

#<=>, #as

Constructor Details

This class inherits a constructor from Filigree::SingleObjectPattern

Instance Method Details

#match?(object, _) ⇒ Boolean

Test the object for equality to the pattern element.

Parameters:

  • object (Object)

    Object to test pattern against

Returns:

  • (Boolean)


392
393
394
# File 'lib/filigree/match.rb', line 392

def match?(object, _)
	object == @pattern_elem
end

#weightObject



396
397
398
# File 'lib/filigree/match.rb', line 396

def weight
	0
end