File Coverage

blib/lib/Sub/Rate/NoMaxRate.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Sub::Rate::NoMaxRate;
2 1     1   22898 use strict;
  1         2  
  1         38  
3 1     1   6 use warnings;
  1         2  
  1         30  
4 1     1   1096 use Any::Moose;
  1         36045  
  1         8  
5              
6 1     1   627 use List::Util 'sum';
  1         4  
  1         289  
7              
8             extends 'Sub::Rate';
9              
10             has '+max_rate' => 'default' => 0;
11              
12             before add => sub {
13             my ($self, $rate) = @_;
14             $self->max_rate($self->max_rate + $rate);
15             };
16              
17             after clear => sub {
18             my ($self) = @_;
19             $self->max_rate(0);
20             };
21              
22             __PACKAGE__->meta->make_immutable;
23              
24             __END__