File Coverage

blib/lib/Mojolicious/Plugin/TypeModel.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 14 14 100.0


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::TypeModel;
2              
3 1     1   13027 use Mojo::Base 'Mojolicious::Plugin';
  1         2  
  1         6  
4              
5             sub register {
6 1     1 1 33 my ($plugin, $app, $conf) = @_;
7 1         2 my $base = $conf->{base};
8 1         6 my $types = $base->types;
9              
10             # model aliases
11 1         6 for my $type (keys %$types) {
12 1     2   7 $app->helper("model.$type" => sub { shift; $base->model($type => @_) });
  2         19575  
  2         11  
13             }
14             }
15              
16             1;
17