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 inherited from Pattern

Pattern::PATTERN_METHODS

Constants included from Mustermann

DEFAULT_TYPE, VERSION

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, register

Constructor Details

#initialize(string, options = {}) ⇒ Pattern

Returns a new instance of Pattern.

Parameters:

  • string (String)

    the string representation of the pattern

  • options (Hash) (defaults to: {})

    options for fine-tuning the pattern behavior

See Also:



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

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