File Coverage

blib/lib/String/Eertree/Node.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition 2 2 100.0
subroutine 4 4 100.0
pod 0 2 0.0
total 14 16 87.5


line stmt bran cond sub pod time code
1             package String::Eertree::Node;
2              
3 6     6   36 use Moo;
  6         13  
  6         27  
4              
5             has length => (is => 'ro', required => 1);
6             has pos => (is => 'rwp', required => 1);
7             has link => (is => 'rwp');
8 156     156   2954 has edge => (is => 'lazy', predicate => 1, builder => sub { {} }, );
9             has count => (is => 'rwp', default => 1);
10             has step_tally => (is => 'rwp', default => 1);
11              
12             sub increment_count {
13 26     26 0 34 my ($self, $count) = @_;
14 26   100     73 $self->_set_count(($count // 1) + $self->count);
15             }
16              
17             sub string {
18 220     220 0 5425 my ($self, $eertree) = @_;
19 220         674 return substr $eertree->string, $self->pos, $self->length
20             }
21              
22             =head1 NAME
23              
24             String::Eertree::Node - Represents a single node in a String::Eertree
25              
26             =head1 VERSION
27              
28             Version 0.01
29              
30             =cut
31              
32             our $VERSION = '0.01';
33              
34             =head1 SYNOPSIS
35              
36             You can study the implementation if you're interested in how eertrees
37             work. Otherwise, just use C.
38              
39             =cut
40              
41             __PACKAGE__