blib/lib/Pinto/RevisionWalker.pm

filter: Statementstmt 100% 24 / 24 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 94.2% 33 / 35 CC 3 SCAR 5.6
CC
3
Cov
96%
next
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« blib/lib/Pinto/Server.pm ↑ Summary blib/lib/Pinto/Action/Kill.pm »
1 # ABSTRACT: Iterates through revision history
2  
3 package Pinto::RevisionWalker;
4  
5 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use MooseX::Types::Moose qw(ArrayRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use MooseX::MarkAsMethods ( autoclean => 1 );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #------------------------------------------------------------------------------
11  
12 3 our $VERSION = '0.14'; # VERSION
13  
14 #------------------------------------------------------------------------------
15 # TODO: Rethink this API. Do we need start? Can we just use queue? What
16 # about filtering, or walking forward? Sort chronological or topological?
17  
18 3 has start => (
19 is => 'ro',
20 isa => 'Pinto::Schema::Result::Revision',
21 required => 1,
22 );
23  
24 has queue => (
25 isa => ArrayRef,
26 traits => [qw(Array)],
27 handles => { enqueue => 'push', dequeue => 'shift' },
28 2 ▶ default => sub { [ $_[0]->start ] },
Subroutine __ANON__: called CC=1 SCAR=0.0
29 3 lazy => 1,
30 );
31  
32 #------------------------------------------------------------------------------
33  
34 5 ▶sub next {
Subroutine next: called CC=3 SCAR=11.0
Pod undocumented
35 5 my ($self) = @_;
36  
37 5 my $next = $self->dequeue;
38  
39 5 ▶ return if not $next;
Branch: 1 branch
BranchTrueFalseTotal
unless $next 0 5 5
40 5 ▶ return if $next->is_root;
Branch: 1 branch
BranchTrueFalseTotal
if $next->is_root 2 3 5
41  
42 3 $self->enqueue( $next->parents );
43  
44 3 return $next;
45 }
46  
47 #------------------------------------------------------------------------------
48  
49 3 __PACKAGE__->meta->make_immutable;
50  
51 #-------------------------------------------------------------------------------
52 3 1;
53  
54 __END__
« blib/lib/Pinto/Server.pm ↑ Summary blib/lib/Pinto/Action/Kill.pm »