Timeline.pm

filter: Statementstmt 58.3% 14 / 24 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod 100% 3 / 3 totaltotal 53.8% 21 / 39 CC 2 SCAR 9.2
CC
2
Cov
52%
filter_timeline_by_date
6.0
merge_timeline
2.0
filter_timeline_by_type
2.0
CRAP 2.5
« Timeline/Formatter/HTML.pm ↑ Summary Timeline/Builder.pm »
1 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Data::Timeline;
6 2 our $VERSION = '1.100860';
7 # ABSTRACT: Time line represented as an object
8 2 ▶use parent qw(Class::Accessor::Complex Class::Accessor::Constructor);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 __PACKAGE__
10 ->mk_constructor
11 ->mk_array_accessors(qw(entries));
12  
13 0 ▶sub merge_timeline {
Subroutine merge_timeline: not called CC=1 SCAR=6.9
Pod documented
14 0 my ($self, $timeline) = @_;
15 0 $self->entries(sort { $a->timestamp <=> $b->timestamp }
16 ($self->entries, $timeline->entries));
17 0 $self; # for chaining
18 }
19  
20 0 ▶sub filter_timeline_by_type {
Subroutine filter_timeline_by_type: not called CC=1 SCAR=6.9
Pod documented
21 0 my ($self, $type) = @_;
22 0 Data::Timeline->new(entries => grep { $_->type eq $type } $self->entries);
23 }
24  
25 0 ▶sub filter_timeline_by_date {
Subroutine filter_timeline_by_date: not called CC=2 SCAR=17.9
Pod documented
26 0 my ($self, $from, $to) = @_;
27 Data::Timeline->new(
28 0 ▶ entries => grep { ($from <= $_->timestamp) && ($_->timestamp <= $to) }
Condition0%0/3
$from <= $_->timestamp && $_->timestamp <= $to
!ll&&!rl&&r
000
MC/DC0%0/2
$from <= $_->timestamp && $_->timestamp <= $to
$from <= $_->timestamp $_->timestamp <= $to
Truth table0%0/3
A && B
A= $from <= $_->timestampB= $_->timestamp <= $to
ABresult
0X0
100
111
29 $self->entries);
30 }
31 2 1;
32  
33  
34 __END__
« Timeline/Formatter/HTML.pm ↑ Summary Timeline/Builder.pm »