File Coverage

blib/lib/Template/Plugin/Path/Tiny.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 26 28 92.8


line stmt bran cond sub pod time code
1             package Template::Plugin::Path::Tiny;
2              
3             # ABSTRACT: use Path::Tiny objects from within templates
4              
5 1     1   67595 use Moo;
  1         13573  
  1         6  
6             extends qw/ Template::Plugin /;
7              
8 1     1   1489 use Path::Tiny;
  1         2  
  1         49  
9 1     1   605 use Types::Standard -types;
  1         86200  
  1         15  
10              
11 1     1   7733 use namespace::autoclean;
  1         14211  
  1         4  
12              
13             our $VERSION = 'v0.1.0';
14              
15             has context => (
16             is => 'ro',
17             isa => Object,
18             weak_ref => 1,
19             );
20              
21             sub BUILD {
22 6     6 0 391 my ($self) = @_;
23              
24 6         1072 $self->context->define_vmethod( scalar => as_path => \&path );
25              
26             $self->context->define_vmethod(
27 6     3   154 list => as_path => sub { path( @{ $_[0] } ) } );
  3         119  
  3         11  
28              
29             }
30              
31             sub BUILDARGS {
32 6     6 0 24613 my ( $class, $context ) = @_;
33              
34 6         108 return { context => $context };
35             }
36              
37              
38             1;
39              
40             __END__