Class: Mustermann::RegexpBased Abstract
- Extended by:
- Forwardable
- Defined in:
- lib/mustermann/regexp_based.rb
Overview
This class is abstract.
Superclass for patterns that internally compile to a regular expression.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#regexp ⇒ Regexp
(also: #to_regexp)
readonly
Regular expression equivalent to the pattern.
Instance Method Summary collapse
-
#initialize(string, **options) ⇒ Pattern
constructor
A new instance of Pattern.
Methods inherited from Pattern
#===, #=~, #expand, #match, #named_captures, #names, new, #params, supported?, supported_options, #to_s
Constructor Details
#initialize(string, **options) ⇒ Pattern
Returns a new instance of Pattern.
16 17 18 19 |
# File 'lib/mustermann/regexp_based.rb', line 16 def initialize(string, **) @regexp = compile(string, **) super end |
Instance Attribute Details
#regexp ⇒ Regexp (readonly) Also known as: to_regexp
Returns regular expression equivalent to the pattern.
10 11 12 |
# File 'lib/mustermann/regexp_based.rb', line 10 def regexp @regexp end |