File Coverage

blib/lib/WebService/UrbanDictionary/Term.pm
Criterion Covered Total %
statement 13 13 100.0
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 1 2 50.0
total 19 21 90.4


line stmt bran cond sub pod time code
1             package WebService::UrbanDictionary::Term;
2              
3             # ABSTRACT: The Term object filled by WebService::UrbanDictionary objects.
4              
5 1     1   4 use Moo;
  1         2  
  1         8  
6 1     1   606 use WebService::UrbanDictionary::Term::Definition;
  1         4  
  1         161  
7              
8             has 'term' => ( is => 'ro' );
9             has 'tags' => ( is => 'ro' );
10             has 'result_type' => ( is => 'ro' );
11             has 'definitions' => ( is => 'ro' );
12             has 'sounds' => ( is => 'ro' );
13              
14             sub BUILD {
15 1     1 0 3365 my $self = shift;
16 1         3 my $params = shift;
17 9         2153 $self->{definitions} = [
18 1         2 map { WebService::UrbanDictionary::Term::Definition->new($_) } @{$params->{list}}
  1         4  
19             ];
20             }
21              
22             sub definition {
23 1     1 1 571 my $defs = shift->definitions;
24 1 50       12 return (wantarray ? @$defs : $defs->[0]->definition);
25             }
26              
27             1;
28              
29             __END__