File Coverage

blib/lib/Cinnamon/Role.pm
Criterion Covered Total %
statement 17 19 89.4
branch 4 4 100.0
condition n/a
subroutine 5 6 83.3
pod 0 2 0.0
total 26 31 83.8


line stmt bran cond sub pod time code
1             package Cinnamon::Role;
2 1     1   108403 use strict;
  1         3  
  1         24  
3 1     1   4 use warnings;
  1         2  
  1         24  
4              
5 1     1   798 use Moo;
  1         12353  
  1         5  
6 1     1   2210 use Hash::MultiValue;
  1         2178  
  1         161  
7              
8             has name => (is => 'ro', required => 1);
9             has hosts => (is => 'ro', required => 1);
10             has params => (is => 'ro', default => sub { Hash::MultiValue->new });
11              
12             sub get_hosts {
13 3     3 0 151 my ($self) = @_;
14 3         8 my $hosts = $self->hosts;
15 3 100       10 if (ref $hosts eq 'CODE') {
16 1         3 return $hosts->();
17             }
18 2 100       15 return ref $hosts eq 'ARRAY' ? $hosts : [$hosts];
19             }
20              
21             sub info {
22 0     0 0   my ($self) = @_;
23             return +{
24 0           hosts => $self->get_hosts,
25             params => $self->params->as_hashref,
26             };
27             }
28              
29             1;