NAME

Routes::Tiny::Pattern - Routes pattern

SYNOPSIS

my $pattern = Routes::Tiny::Pattern->new(
    pattern  => '/:foo/:bar',
    defaults => {bar => 'index'},
    name     => 'route'
);

my $match = $pattern->match('/hello/world');

my $path = $pattern->build_path('route', foo => 'hello', bar => 'world');

DESCRIPTION

Routes::Tiny::Pattern is an Object that incapsulates pattern matching and path building.

ATTRIBUTES

defaults

Pass default values for captures.

constraints

Pass constraints.

name

Pass route name.

arguments

Pass arbitrary arguments.

METHODS

new

my $pattern = Routes::Tiny::Pattern->new;

Create new instance of Routes::Tiny::Pattern.

match

Match pattern agains a path.

build_path

$pattern->build_path('name', {foo => 'bar'});

Build path from a given name and params.