lib/Rapi/Blog/Template/Dispatcher/ViewWrapper.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 67 CC 3 SCAR 15.5
CC
3
Cov
0%
resolved
12.0
rank
2.0
BEGIN
2.0
CRAP 4.7
1 package Rapi::Blog::Template::Dispatcher::ViewWrapper;
2 use strict;
3 use warnings;
4
5 use RapidApp::Util qw(:all);
6 use Rapi::Blog::Util;
7 use List::Util;
8
9 use Moo;
10 extends 'Rapi::Blog::Template::Dispatcher';
11
12 use Types::Standard ':all';
13
14
15 has 'ViewWrapper', is => 'ro', lazy => 1, default => sub {
16 my $self = shift;
17 $self->Scaffold->resolve_ViewWrapper($self->path)
18 }, isa => InstanceOf['Rapi::Blog::Scaffold::ViewWrapper'];
19
20
21 has 'subpath', is => 'ro', lazy => 1, default => sub {
22 my $self = shift;
23 $self->ViewWrapper ? $self->ViewWrapper->resolve_subpath($self->path) : undef
24 }, isa => Maybe[Str];
25
26
27 sub rank { 30 }
28
29 has 'PostDispatcher', is => 'ro', lazy => 1, default => sub {
30 my $self = shift;
31 $self->_factory_for('Post', name => $self->subpath);
32 };#, isa => InstanceOf['Rapi::Blog::Template::Dispatcher::Post'];
33
34
35 has '+exists', default => sub { (shift)->PostDispatcher->exists };
36 has '+mtime', default => sub { (shift)->PostDispatcher->mtime };
37 has '+template_vars', default => sub { (shift)->PostDispatcher->template_vars };
38
39
40 has '+content', default => sub {
41 my $self = shift;
42 $self->ViewWrapper->render_post_wrapper($self->subpath)
43 };
44
45
46
47 sub resolved {
48 my $self = shift;
49
50 $self->subpath or return undef;
51
52 my $FileDispatcher = $self->_factory_for('ScaffoldFile', path => $self->subpath);
53 return $FileDispatcher if ($FileDispatcher->is_static);
54
55 $self->exists ? $self : $self->_factory_for('NotFound')
56
57 }
58
59
60
61
62
63
64
65 1;