File Coverage

lib/Book/Bilingual/Dlineset.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 1 5 20.0
total 29 33 87.8


line stmt bran cond sub pod time code
1             package Book::Bilingual::Dlineset;
2             # ABSTRACT: A set of dual language lines
3 4     4   791 use Mojo::Base -base;
  4         7  
  4         20  
4 4     4   528 use Carp;
  4         7  
  4         1067  
5              
6             has 'set'; # Arrayref of Dlines
7              
8 196     196 1 1566 sub new { $_[0]->SUPER::new({ set => [] }) }
9             sub dline_count {
10 108     108 0 144 my ($self) = @_;
11 108         99 return scalar @{$self->{set}};
  108         167  
12             }
13             sub dline_at { ## ($idx :>Int) :> Dline
14 52     52 0 59 my ($self, $idx) = @_;
15              
16 52         68 return $self->{set}[$idx];
17             }
18             sub target { ## () :> Dline
19 90     90 0 103 my ($self, $idx) = @_;
20              
21 90         209 return $self->{set}[-1];
22             }
23             sub push { ## ($d:Dline) :> $Dlineset
24 7     7 0 69 my ($self,$d) = @_;
25              
26 7 100       197 croak 'Not a Book::Bilingual::Dline'
27             unless ref($d) eq 'Book::Bilingual::Dline';
28              
29 6         6 push @{$self->{set}}, $d;
  6         14  
30              
31 6         16 return $self;
32             }
33              
34             1;