Class: Mustermann::Regular

Inherits:
RegexpBased show all
Defined in:
lib/mustermann/regular.rb

Overview

Regexp pattern implementation.

Examples:

Mustermann.new('/.*', type: :regexp) === '/bar' # => true

See Also:

Constant Summary

Constants included from Mustermann

DEFAULT_TYPE

Instance Attribute Summary

Attributes inherited from RegexpBased

#regexp

Instance Method Summary collapse

Methods inherited from RegexpBased

#peek_match, #peek_size

Methods inherited from Pattern

#===, #=~, #expand, #match, #named_captures, #names, new, #params, #peek, #peek_match, #peek_params, #peek_size, supported?, supported_options, #to_proc, #to_s, #to_templates, #|

Methods included from Mustermann

[], new

Constructor Details

#initialize(string, **options) ⇒ Pattern

Returns a new instance of Pattern.

Parameters:

  • string (String)

    the string representation of the pattern

  • options (Hash)

    options for fine-tuning the pattern behavior

See Also:



18
19
20
21
# File 'lib/mustermann/regular.rb', line 18

def initialize(string, **options)
  string = $1 if string.to_s =~ /\A\(\?\-mix\:(.*)\)\Z/ && string.inspect == "/#$1/"
  super(string, **options)
end