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:

Instance Attribute Summary

Attributes inherited from RegexpBased

#regexp

Instance Method Summary collapse

Methods inherited from Pattern

#===, #=~, #expand, #match, #named_captures, #names, new, #params, supported?, supported_options, #to_s

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:



15
16
17
18
# File 'lib/mustermann/regular.rb', line 15

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