Markdent/CapturedEvents.pm

filter: Statementstmt 100% 42 / 42 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 3 / 3 totaltotal 100% 57 / 57 CC 2 SCAR 1.4
CC
2
Cov
100%
replay_events
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Markdent/Handler/HTMLFilter.pm ↑ Summary Markdent/Event/EndCode.pm »
1 package Markdent::CapturedEvents;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '0.41';
8  
9 4 ▶use Markdent::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use Params::ValidationCompiler qw( validation_for );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Specio::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 has _events => (
17 is => 'ro',
18 isa => t( 'ArrayRef', of => t('EventObject') ),
19 init_arg => 'events',
20 1 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
21 4 );
22  
23 3 ▶sub events {
Subroutine events: called CC=1 SCAR=0.0
Pod documented
24 3 @{ $_[0]->_events };
25 }
26  
27 {
28 4 my $validator = validation_for(
29 params => [ { type => t('EventObject') } ],
30 slurpy => t('EventObject'),
31 );
32  
33 264 ▶ sub capture_events {
Subroutine capture_events: called CC=1 SCAR=0.0
Pod documented
34 264 my $self = shift;
35 264 my @events = $validator->(@_);
36  
37 264 push @{ $self->_events }, @events;
38 }
39 }
40  
41 {
42 4 my $validator = validation_for(
43 params => [ { type => t('HandlerObject') } ],
44 );
45  
46 2 ▶ sub replay_events {
Subroutine replay_events: called CC=2 SCAR=6.9
Pod documented
47 2 my $self = shift;
48 2 my ($handler) = $validator->(@_);
49  
50 2 $handler->handle_event($_) for $self->events;
51 }
52 }
53  
54 4 __PACKAGE__->meta->make_immutable;
55  
56 4 1;
57  
58 # ABSTRACT: Represents a series of captured events
59  
60 __END__
« Markdent/Handler/HTMLFilter.pm ↑ Summary Markdent/Event/EndCode.pm »