BoardStreams/Update.pm

filter: Statementstmt 68.4% 13 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 0.0% 0 / 3 totaltotal 51.7% 15 / 29 CC 3 SCAR 13.5
CC
3
Cov
62%
state
6.0
emit
6.0
events
1.1
CRAP 3.9
« BoardStreams/Client.pm ↑ Summary BoardStreams/Client/Channel.pm »
1 2 ▶use v5.44;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use experimental 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 # Passed to the callback of BoardStreams::Hub->update. The callback changes
5 # the channel's state through it and queues events; both are committed
6 # together under one sequence number.
7 2 class BoardStreams::Update {
8 2 our $VERSION = "v0.0.60";
9  
10 2 field $state :param;
11 2 field @events;
12  
13 # With no argument returns the state (change it in place);
14 # with an argument replaces it.
15 0 ▶ method state (@new) {
Subroutine state: not called CC=2 SCAR=17.9
Pod undocumented
16 0 ▶ $state = $new[0] if @new;
Branch: 1 branch
BranchTrueFalseTotal
if @new 0 0 0
17 0 return $state;
18 2 }
19  
20 0 ▶ method emit ($name, $payload = undef) {
Subroutine emit: not called CC=2 SCAR=17.9
Pod undocumented
21 0 push @events, { name => $name, payload => $payload };
22 0 return $self;
23 2 }
24  
25 0 ▶ method events { @events }
Subroutine events: not called CC=1 SCAR=1.2
Pod undocumented
26 }
27  
28 2 1;
« BoardStreams/Client.pm ↑ Summary BoardStreams/Client/Channel.pm »