NAME

MojoX::Renderer - Renderer

SYNOPSIS

use MojoX::Renderer;

my $renderer = MojoX::Renderer->new;

DESCRIPTION

MojoX::Renderer is a MIME type based renderer.

ATTRIBUTES

default_ext

default_extension

my $ext   = $renderer->default_ext;
my $ext   = $renderer->default_extension;
$renderer = $renderer->default_ext('phtml');
$renderer = $renderer->default_extension('phtml');

handler

my $handler = $renderer->handler;
$renderer   = $renderer->handler({phtml => sub { ... }});

types

my $types = $renderer->types;
$renderer = $renderer->types(MojoX::Types->new);

root

my $root  = $renderer->root;
$renderer = $renderer->root('/foo/bar/templates');

METHODS

MojoX::Types inherits all methods from Mojo::Base and implements the follwing the ones.

add_handler

$renderer = $renderer->add_handler(phtml => sub { ... });

render

$renderer = $renderer->render($tx, {template => 'foo.phtml'});