File Coverage

blib/lib/WWW/DuckDuckGo/Icon.pm
Criterion Covered Total %
statement 13 13 100.0
branch 5 6 83.3
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 22 24 91.6


line stmt bran cond sub pod time code
1             package WWW::DuckDuckGo::Icon;
2             BEGIN {
3 2     2   28912 $WWW::DuckDuckGo::Icon::AUTHORITY = 'cpan:DDG';
4             }
5             {
6             $WWW::DuckDuckGo::Icon::VERSION = '0.016';
7             }
8             # ABSTRACT: A DuckDuckGo Icon definition
9              
10 2     2   920 use Moo;
  2         19130  
  2         15  
11 2     2   3228 use URI;
  2         7997  
  2         348  
12              
13             sub by {
14 2     2 0 895 my ( $class, $icon_result ) = @_;
15 2         4 my %params;
16 2 50       20 $params{url} = URI->new($icon_result->{URL}) if $icon_result->{URL};
17 2 100       11326 $params{height} = $icon_result->{Height} if $icon_result->{Height};
18 2 100       12 $params{width} = $icon_result->{Width} if $icon_result->{Width};
19 2         42 __PACKAGE__->new(%params);
20             }
21              
22             has url => (
23             is => 'ro',
24             predicate => 'has_url',
25             );
26              
27             has width => (
28             is => 'ro',
29             predicate => 'has_width',
30             );
31              
32             has height => (
33             is => 'ro',
34             predicate => 'has_height',
35             );
36              
37             1;
38              
39             __END__