File Coverage

blib/lib/App/RecordStream/Aggregator/InjectInto/Field.pm
Criterion Covered Total %
statement 37 39 94.8
branch 1 2 50.0
condition n/a
subroutine 12 13 92.3
pod 0 7 0.0
total 50 61 81.9


line stmt bran cond sub pod time code
1             package App::RecordStream::Aggregator::InjectInto::Field;
2              
3             our $VERSION = "4.0.23";
4              
5 12     12   72 use strict;
  12         25  
  12         288  
6 12     12   58 use warnings;
  12         30  
  12         293  
7              
8 12     12   2860 use App::RecordStream::DomainLanguage::Registry;
  12         36  
  12         311  
9 12     12   70 use App::RecordStream::DomainLanguage::Valuation::KeySpec;
  12         27  
  12         246  
10 12     12   2716 use App::RecordStream::Aggregator::InjectInto;
  12         30  
  12         338  
11              
12 12     12   58 use base qw(App::RecordStream::Aggregator::InjectInto);
  12         26  
  12         3036  
13              
14             sub new
15             {
16 8     8 0 118 my $class = shift;
17 8         18 my $field = shift;
18              
19 8         118 return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field));
20             }
21              
22             sub new_from_valuation
23             {
24 14     14 0 33 my $class = shift;
25 14         26 my $valuation = shift;
26              
27 14         42 my $this =
28             {
29             'valuation' => $valuation,
30             };
31              
32 14         33 bless $this, $class;
33              
34 14         54 return $this;
35             }
36              
37             sub initial
38             {
39 48     48 0 122 return undef;
40             }
41              
42             sub combine
43             {
44 542     542 0 860 my $this = shift;
45 542         829 my $cookie = shift;
46 542         849 my $record = shift;
47              
48 542         1058 my $value = $this->get_valuation()->evaluate_record($record);
49              
50 542 50       1336 if ( defined $value )
51             {
52 542         1491 return $this->combine_field($cookie, $value);
53             }
54             else
55             {
56 0         0 return $cookie;
57             }
58             }
59              
60             sub get_valuation
61             {
62 542     542 0 848 my $this = shift;
63 542         1577 return $this->{'valuation'};
64             }
65              
66             sub squish
67             {
68 48     48 0 177 my ($this, $cookie) = @_;
69              
70 48         114 return $cookie;
71             }
72              
73             sub argct
74             {
75 0     0 0   return 1;
76             }
77              
78             1;