Method: Addressable::Template#to_regexp

Defined in:
lib/addressable/template.rb

#to_regexpRegexp

Coerces a template into a ‘Regexp` object. This regular expression will behave very similarly to the actual template, and should match the same URI values, but it cannot fully handle, for example, values that would extract to an `Array`.

Returns:

  • (Regexp)

    A regular expression which should match the template.



630
631
632
633
# File 'lib/addressable/template.rb', line 630

def to_regexp
  _, source = parse_template_pattern(pattern)
  Regexp.new(source)
end