File Coverage

blib/lib/Game/Cribbage/Rounds.pm
Criterion Covered Total %
statement 21 22 95.4
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 28 30 93.3


line stmt bran cond sub pod time code
1             package Game::Cribbage::Rounds;
2              
3 8     8   40 use strict;
  8         11  
  8         253  
4 8     8   27 use warnings;
  8         10  
  8         1873  
5              
6 8     8   37 use Object::Proto::Sugar -types;
  8         8  
  8         47  
7 8     8   8822 use Game::Cribbage::Round;
  8         72  
  8         340  
8              
9             has number => (
10             is => 'ro',
11             isa => Int
12             );
13              
14             has history => (
15             is => 'rw',
16             isa => ArrayRef,
17             default => []
18             );
19              
20             has current_round => (
21             is => 'rw',
22             isa => Object,
23             );
24              
25             sub next_round {
26 35     35 1 974 my ($self, $game, %args) = @_;
27 35 50       40 if (scalar @{$self->history} >= $self->number) {
  35         134  
28 0         0 die 'DISPLAY THE RESULT FOR THE GAME';
29             }
30             my $round = Game::Cribbage::Round->new(
31 35         43 number => scalar @{$self->history} + 1,
  35         195  
32             %args
33             )->init($game);
34 35         48 push @{$self->history}, $round;
  35         55  
35 35         65 $self->current_round($round);
36 35         66 return $self;
37             }
38              
39             1;
40              
41             __END__