<commit_before># Copyright (C) 2008, <NAME>.

package Mojolicious::Renderer;

use strict;
use warnings;

use base 'MojoX::Renderer';

use Mojo::Template;

# What do you want?
# I'm here to kick your ass!
# Wishful thinking. We have long since evolved beyond the need for asses.
sub new {
    my $self = shift->SUPER::new(@_);
    $self->default_ext('phtml');
    $self->add_handler(phtml => sub {
        my ($self, $args) = @_;
        Mojo::Template->new->render_file(
            $args->{path}, $args->{output}, $args->{c}, $args
        );
    });
    return $self;
}

1;
__END__

=head1 NAME

Mojolicious::Renderer - Renderer

=head1 SYNOPSIS

    use Mojolicious::Renderer;

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

=head1 DESCRIPTION

L<Mojolicous::Renderer> is the default L<Mojolicious> renderer.

=head1 ATTRIBUTES<commit_msg>made mojolicious 90% faster by keeping mt templates in memory<commit_after># Copyright (C) 2008, <NAME>.

package Mojolicious::Renderer;

use strict;
use warnings;

use base 'MojoX::Renderer';

use Mojo::Template;

# What do you want?
# I'm here to kick your ass!
# Wishful thinking. We have long since evolved beyond the need for asses.
sub new {
    my $self = shift->SUPER::new(@_);
    $self->default_ext('phtml');
    $self->add_handler(phtml => sub {
        my ($self, $args) = @_;

        my $path = $args->{path};

        # Check cache
        $self->{_mt_cache} ||= {};
        my $mt = $self->{_mt_cache}->{$path};

        # No cache
        unless ($mt) {

            # Initialize
            $mt = $self->{_mt_cache}->{$path} = Mojo::Template->new;
            return $mt->render_file(
                $path, $args->{output}, $args->{c}, $args
            );
        }

        # Interpret again
        $mt->interpret($args->{output}, $args->{c}, $args);
    });
    return $self;
}

1;
__END__

=head1 NAME

Mojolicious::Renderer - Renderer

=head1 SYNOPSIS

    use Mojolicious::Renderer;

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

=head1 DESCRIPTION

L<Mojolicous::Renderer> is the default L<Mojolicious> renderer.

=head1 ATTRIBUTES
{'fraction_non_alphanumeric': 0.15216357584403234, 'fraction_numerical': 0.009510223490252021, 'mean_word_length': 2.940074906367041, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5689176', 'n_tokens_mistral': 752, 'n_tokens_neox': 722, 'n_words': 189}