File Coverage

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


line stmt bran cond sub pod time code
1             package Bot::ChatBots::Role::Sender;
2 2     2   82415 use strict;
  2         2  
  2         87  
3 2     2   10 use warnings;
  2         4  
  2         116  
4             { our $VERSION = '0.006'; }
5              
6 2     2   23 use Moo::Role;
  2         3  
  2         13  
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 4 my ($self, $record) = @_;
19              
20             $record->{sent_message} = $self->send_message($record->{send_message})
21 2 100 33     18 if (ref($record) eq 'HASH') && exists($record->{send_message});
22              
23 2         19 return $record; # pass-through anyway
24             } ## end sub process
25              
26             1;