blib/lib/Yukki/Web/Plugin/Role/Formatter.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 28 CC 3 SCAR 15.4
CC
3
Cov
0%
has_format
6.0
format
6.0
BEGIN
2.0
CRAP 4.7
1 package Yukki::Web::Plugin::Role::Formatter;
2 {
3 $Yukki::Web::Plugin::Role::Formatter::VERSION = '0.140290';
4 }
5 use 5.12.1;
6 use Moose::Role;
7  
8 # ABSTRACT: interface for HTML formatters
9  
10  
11 requires qw( html_formatters );
12  
13  
14 sub has_format {
15 my ($self, $media_type) = @_;
16 return unless defined $media_type;
17 return defined $self->html_formatters->{$media_type};
18 }
19  
20  
21 sub format {
22 my ($self, $params) = @_;
23  
24 my $media_type = $params->{file}->media_type;
25 return unless $self->has_format($media_type);
26  
27 my $format = $self->html_formatters->{$media_type};
28 return $self->$format($params);
29 }
30  
31 1;
32  
33 __END__