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   873 use Mojo::Base -base;
  4         6  
  4         23  
4 4     4   561 use Carp;
  4         6  
  4         1081  
5              
6             has 'set'; # Arrayref of Dlines
7              
8 187     187 1 1417 sub new { $_[0]->SUPER::new({ set => [] }) }
9             sub dline_count {
10 93     93 0 107 my ($self) = @_;
11 93         72 return scalar @{$self->{set}};
  93         131  
12             }
13             sub at { ## ($idx :>Int) :> Dline
14 1     1 0 2 my ($self, $idx) = @_;
15              
16 1         4 return $self->{set}[$idx];
17             }
18             sub target { ## () :> Dline
19 84     84 0 96 my ($self, $idx) = @_;
20              
21 84         154 return $self->{set}[-1];
22             }
23             sub push { ## ($d:Dline) :> $Dlineset
24 7     7 0 55 my ($self,$d) = @_;
25              
26 7 100       170 croak 'Not a Book::Bilingual::Dline'
27             unless ref($d) eq 'Book::Bilingual::Dline';
28              
29 6         8 push @{$self->{set}}, $d;
  6         14  
30              
31 6         15 return $self;
32             }
33              
34             1;