File Coverage

blib/lib/Mojo/Feed/Item/Enclosure.pm
Criterion Covered Total %
statement 8 11 72.7
branch n/a
condition n/a
subroutine 3 6 50.0
pod 2 2 100.0
total 13 19 68.4


line stmt bran cond sub pod time code
1             package Mojo::Feed::Item::Enclosure;
2 12     12   89 use Mojo::Base -base;
  12         25  
  12         99  
3              
4             use overload
5 0     0   0 bool => sub {1},
6 0     0   0 '""' => sub { shift->to_string },
7 12     12   2731 fallback => 1;
  12         30  
  12         151  
8              
9              
10             has 'dom';
11              
12             has length => sub { shift->dom->attr('length'); };
13             has type => sub { shift->dom->attr('type'); };
14             has url => sub { my $attr = shift->dom->attr; $attr->{url} || $attr->{href} };
15              
16             sub to_hash {
17 14     14 1 173 return {map { $_ => $_[0]->$_ } (qw(length type url))};
  42         589  
18             }
19              
20             sub to_string {
21 0     0 1   shift->dom->to_string;
22             }
23              
24             1;
25              
26             __END__