File Coverage

blib/lib/Bot/ChatBots/Role/Sender.pm
Criterion Covered Total %
statement 12 12 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 4 4 100.0
pod 1 1 100.0
total 21 22 95.4


line stmt bran cond sub pod time code
1             package Bot::ChatBots::Role::Sender;
2 2     2   82582 use strict;
  2         9  
  2         52  
3 2     2   9 use warnings;
  2         3  
  2         88  
4             { our $VERSION = '0.009'; }
5              
6 2     2   11 use Moo::Role;
  2         4  
  2         11  
7             with 'Bot::ChatBots::Role::Processor';
8             requires 'send_message';
9              
10             has recipient => (
11             is => 'rw',
12             lazy => 1,
13             predicate => 1,
14             clearer => 1,
15             );
16              
17             sub process {
18 2     2 1 6 my ($self, $record) = @_;
19              
20             $record->{sent_message} = $self->send_message($record->{send_message})
21 2 100 66     17 if (ref($record) eq 'HASH') && exists($record->{send_message});
22              
23 2         22 return $record; # pass-through anyway
24             } ## end sub process
25              
26             1;