File Coverage

blib/lib/WebService/ChatWork/Message/Tag/To.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 28 29 96.5


line stmt bran cond sub pod time code
1 1     1   700 use strict;
  1         1  
  1         30  
2 1     1   3 use warnings;
  1         2  
  1         46  
3             package WebService::ChatWork::Message::Tag::To;
4 1     1   3 use overload q{""} => \&as_string;
  1         2  
  1         7  
5 1     1   49 use constant PRIMARY => "account_id";
  1         1  
  1         55  
6 1     1   3 use Mouse;
  1         1  
  1         24  
7              
8             extends "WebService::ChatWork::Message::Tag";
9              
10             has account_id => ( is => "ro", isa => "Int" );
11             has account_name => ( is => "ro", isa => "Str" );
12              
13             sub as_string {
14 2     2 0 39 my $self = shift;
15 2         8 my $string = sprintf "[To:%d]", $self->account_id;
16              
17 2 100       6 if ( defined $self->account_name ) {
18 1         2 $string = join q{ }, $string, $self->account_name;
19             }
20              
21 2         9 return $string;
22             }
23              
24             1;