Class: Filigree::RegexpPattern
- Inherits:
-
SingleObjectPattern
- Object
- BasicPattern
- SingleObjectPattern
- Filigree::RegexpPattern
- Defined in:
- lib/filigree/match.rb
Overview
A pattern that tests a string against a regular expression.
Instance Attribute Summary
Attributes inherited from SingleObjectPattern
Instance Method Summary collapse
-
#match?(object, env) ⇒ Boolean
Test the object to see if it matches the wrapped regular expression.
- #weight ⇒ Object
Methods inherited from SingleObjectPattern
Methods included from AbstractClass
#abstract_method, extended, #install_icvars, #new
Methods inherited from BasicPattern
Constructor Details
This class inherits a constructor from Filigree::SingleObjectPattern
Instance Method Details
#match?(object, env) ⇒ Boolean
Test the object to see if it matches the wrapped regular expression.
406 407 408 409 410 |
# File 'lib/filigree/match.rb', line 406 def match?(object, env) (object.is_a?(String) and (md = @pattern_elem.match(object))).tap do |match| env.send("match_data=", md) if match end end |
#weight ⇒ Object
412 413 414 |
# File 'lib/filigree/match.rb', line 412 def weight 2 end |