File Coverage

blib/lib/App/RecordStream/Deaggregator/Field.pm
Criterion Covered Total %
statement 28 28 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 3 0.0
total 36 39 92.3


line stmt bran cond sub pod time code
1             package App::RecordStream::Deaggregator::Field;
2              
3 1     1   6 use strict;
  1         2  
  1         23  
4 1     1   4 use warnings;
  1         2  
  1         62  
5              
6 1     1   310 use App::RecordStream::Deaggregator::Base;
  1         3  
  1         27  
7 1     1   5 use App::RecordStream::DomainLanguage::Valuation::KeySpec;
  1         2  
  1         23  
8              
9 1     1   5 use base 'App::RecordStream::Deaggregator::Base';
  1         2  
  1         183  
10              
11             sub new
12             {
13 7     7 0 13 my $class = shift;
14 7         15 my $field = shift;
15              
16 7         44 return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field));
17             }
18              
19             sub new_from_valuation
20             {
21 7     7 0 12 my $class = shift;
22 7         14 my $valuation = shift;
23              
24 7         14 my $this =
25             {
26             'valuation' => $valuation,
27             };
28 7         16 bless $this, $class;
29              
30 7         19 return $this;
31             }
32              
33             sub deaggregate
34             {
35 17     17 0 30 my $this = shift;
36 17         24 my $record = shift;
37              
38 17         28 my $valuation = $this->{'valuation'};
39              
40 17         48 my $value = $valuation->evaluate_record($record);
41              
42 17         58 return $this->deaggregate_field($value);
43             }
44              
45             1;