blib/lib/App/RecordStream/Aggregator/UniqArray.pm

filter: Statementstmt 95.0% 38 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 12 / 14 Podpod 0.0% 0 / 8 totaltotal 80.6% 50 / 62 CC 1 SCAR 1.3
CC
1
Cov
95%
long_usage
2.0
argct
2.0
BEGIN
1.0
CRAP 1.1
« blib/lib/App/RecordStream/Clumper/Key.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/UniqConcatenate.pm »
1 package App::RecordStream::Aggregator::UniqArray;
2  
3 7 our $VERSION = "4.0.25";
4  
5 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use App::RecordStream::Aggregator;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use App::RecordStream::DomainLanguage::Registry;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 7 ▶use App::RecordStream::DomainLanguage::Valuation::KeySpec;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 7 ▶use base qw(App::RecordStream::Aggregator::Aggregation);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
15 1 my $class = shift;
16 1 my $field = shift;
17  
18 1 return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field));
19 }
20  
21 10 ▶sub new_from_valuation {
Subroutine new_from_valuation: called CC=1 SCAR=0.0
Pod undocumented
22 10 my $class = shift;
23 10 my $valuation = shift;
24  
25 10 my $this =
26 {
27 'valuation' => $valuation,
28 };
29  
30 10 bless $this, $class;
31  
32 10 return $this;
33 }
34  
35 4 ▶sub squish {
Subroutine squish: called CC=1 SCAR=0.0
Pod undocumented
36 4 my ($this, $cookie) = @_;
37  
38 4 return [ sort keys %$cookie ];
39 }
40  
41 0 ▶sub long_usage {
Subroutine long_usage: not called CC=1 SCAR=6.9
Pod undocumented
42 0 return <<EOF;
43 Usage: uarray,<field>
44 Collect unique values from specified field into an array.
45 EOF
46 }
47  
48 1 ▶sub short_usage {
Subroutine short_usage: called CC=1 SCAR=0.0
Pod undocumented
49 1 return "collect unique values from provided field into an array";
50 }
51  
52 0 ▶sub argct {
Subroutine argct: not called CC=1 SCAR=6.9
Pod undocumented
53 0 return 1;
54 }
55  
56 4 ▶sub initial {
Subroutine initial: called CC=1 SCAR=0.0
Pod undocumented
57 4 return {};
58 }
59  
60 16 ▶sub combine {
Subroutine combine: called CC=1 SCAR=0.0
Pod undocumented
61 16 my ($this, $cookie, $record) = @_;
62  
63 16 my $value = $this->{'valuation'}->evaluate_record($record);
64  
65 16 $cookie->{$value} = 1;
66  
67 16 return $cookie;
68 }
69  
70 7 App::RecordStream::Aggregator->register_implementation('uarray', __PACKAGE__);
71  
72 7 App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'uarray', 'VALUATION');
73  
74 7 1;
« blib/lib/App/RecordStream/Clumper/Key.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/UniqConcatenate.pm »