NAME
MojoX::Routes::Pattern - Pattern
SYNOPSIS
use MojoX::Routes::Pattern;
my $pattern = MojoX::Routes::Pattern->new;
DESCRIPTION
MojoX::Routes::Pattern is a route pattern container.
ATTRIBUTES
defaults
my $defaults = $pattern->defaults;
$pattern = $pattern->defaults({foo => 'bar'});
pattern
my $pattern = $pattern->pattern;
$pattern = $pattern->pattern('/(foo)/(bar)');
quote_end
my $quote = $pattern->quote_end;
$pattern = $pattern->quote_end(']');
quote_start
my $quote = $pattern->quote_start;
$pattern = $pattern->quote_start('[');
regex
my $regex = $pattern->regex;
$pattern = $pattern->regex(qr/\/foo/);
reqs
my $reqs = $pattern->reqs;
$pattern = $pattern->reqs({foo => qr/\w+/});
symbols
my $symbols = $pattern->symbols;
$pattern = $pattern->symbols(['foo', 'bar']);
tree
my $tree = $pattern->tree;
$pattern = $pattern->tree([ ... ]);
METHODS
MojoX::Routes::Pattern inherits all methods from Mojo::Base and implements the follwing the ones.
new
my $pattern = MojoX::Routes::Pattern->new('/(controller)/(action)',
action => qr/\w+/
);
match
my $result = $pattern->match('/foo/bar');
parse
$pattern = $pattern->parse('/(controller)/(action)', action => qr/\w+/);
render
my $string = $pattern->render(action => 'foo');
my $string = $pattern->render({action => 'foo'});
shape_match
my $result = $pattern->shape_match(\$path);