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
requirements
my $requirements = $pattern->reqs;
my $requirements = $pattern->requirements;
$pattern = $pattern->reqs({foo => qr/\w+/});
$pattern = $pattern->requirements({foo => qr/\w+/});
segments
my $segments = $pattern->segments;
$pattern = $pattern->segments(4);
symbol_start
my $symbol_start = $pattern->symbol_start;
$pattern = $pattern->symbol_start(':');
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.
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'});