blib/lib/Bot/Cobalt/IRC/Message.pm

filter: Statementstmt 60.0% 21 / 35 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 4 / 12 Podpod n/a totaltotal 43.8% 25 / 57 CC 6 SCAR 16.0
CC
6
Cov
47%
__ANON__
12.0
__ANON__
6.0
__ANON__
6.0
CRAP 4.9
« blib/lib/Bot/Cobalt/Plugin/RDB/SearchCache.pm ↑ Summary blib/lib/Bot/Cobalt.pm »
1 package Bot::Cobalt::IRC::Message;
2 1 $Bot::Cobalt::IRC::Message::VERSION = '0.021003';
3 ## Message class. Inherits from Event
4  
5 2 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Bot::Cobalt::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 extends 'Bot::Cobalt::IRC::Event';
12  
13 has message => (
14 required => 1,
15 is => 'rw',
16 isa => Str,
17 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
18 0 my ($self, $value) = @_;
19  
20 0 ▶ $self->_set_stripped(
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_stripped 0 0 0
21 strip_color( strip_formatting($value) )
22 ) if $self->has_stripped;
23  
24 0 ▶ if ($self->has_message_array) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_message_array) 0 0 0
25 0 $self->message_array([ split ' ', $self->stripped ]);
26 }
27 },
28 1 );
29  
30 has targets => (
31 required => 1,
32 is => 'rw',
33 isa => ArrayObj,
34 coerce => 1,
35 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
36 0 my ($self, $value) = @_;
37 0 ▶ $self->_set_target($value->[0]) if $self->has_target;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_target 0 0 0
38 }
39 1 );
40  
41 has target => (
42 lazy => 1,
43 is => 'rwp',
44 isa => Str,
45 predicate => 'has_target',
46 0 ▶ default => sub { $_[0]->targets->[0] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
47 1 );
48  
49 ## May or may not have a channel.
50 has channel => (
51 lazy => 1,
52 is => 'rw',
53 isa => Str,
54 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
55 0 ▶ $_[0]->target =~ /^[#&+!]/ ? $_[0]->target : ''
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->target =~ /^[#&+!]/ ? : 0 0 0
56 },
57 1 );
58  
59 ## Message content.
60 has stripped => (
61 lazy => 1,
62 is => 'rwp',
63 isa => Str,
64 predicate => 'has_stripped',
65 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
66 0 strip_color( strip_formatting($_[0]->message) )
67 },
68 1 );
69  
70 has message_array => (
71 lazy => 1,
72 is => 'rw',
73 isa => ArrayObj,
74 coerce => 1,
75 predicate => 'has_message_array',
76 0 ▶ default => sub { [ split ' ', $_[0]->stripped ] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
77 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
78 0 my ($self) = @_;
79 0 ▶ if ($self->has_message_array_sp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_message_array_sp) 0 0 0
80 0 $self->_set_message_array_sp([ split / /, $self->stripped ]);
81 }
82 },
83 1 );
84  
85 has message_array_sp => (
86 lazy => 1,
87 is => 'rwp',
88 isa => ArrayObj,
89 coerce => 1,
90 predicate => 'has_message_array_sp',
91 0 ▶ default => sub { [ split / /, $_[0]->stripped ] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
92 1 );
93  
94  
95 1 1;
96 __END__
« blib/lib/Bot/Cobalt/Plugin/RDB/SearchCache.pm ↑ Summary blib/lib/Bot/Cobalt.pm »