blib/lib/Kelp/Module/Encoder.pm

filter: Statementstmt 89.4% 17 / 19 Branchbran n/a Conditioncond 85.7% 6 / 7 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 71.4% 5 / 7 Podpod 20.0% 1 / 5 totaltotal 73.8% 31 / 42 CC 4 SCAR 7.0
CC
4
Cov
88%
get_encoder
3.0
encoder_name
2.0
build_encoder
2.0
CRAP 2.0
« blib/lib/Kelp/Less.pm ↑ Summary blib/lib/Kelp/Exception.pm »
1 package Kelp::Module::Encoder;
2  
3 36 ▶use Kelp::Base 'Kelp::Module';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 36 attr 'args' => undef;
6 48 ▶attr 'encoders' => sub { {} };
Subroutine __ANON__: called CC=1 SCAR=0.0
7  
8 # need to be reimplemented
9 0 ▶sub encoder_name { ... }
Subroutine encoder_name: not called CC=1 SCAR=6.9
Pod undocumented
10 0 ▶sub build_encoder { ... }
Subroutine build_encoder: not called CC=1 SCAR=6.9
Pod undocumented
11  
12 sub build
13 48 ▶{
Subroutine build: called CC=1 SCAR=0.0
Pod documented
14 48 my ($self, %args) = @_;
15 48 $self->args(\%args);
16  
17 48 $self->app->encoder_modules->{$self->encoder_name} = $self;
18 }
19  
20 sub get_encoder_config
21 58 ▶{
Subroutine get_encoder_config: called CC=2 SCAR=6.9
Pod undocumented
22 58 my ($self, $name) = @_;
23  
24 return {
25 58 %{$self->args},
26 58 ▶ %{$self->app->config(join '.', 'encoders', $self->encoder_name, $name) // {}},
Condition100%2/2
$self->app->config(join(".", "encoders", $self->encoder_name, $name)) // {}
l!l
1048
MC/DC100%1/1
$self->app->config(join(".", "encoders", $self->encoder_name, $name)) // {}
$self->app->config(join(".", "encoders", $self->encoder_name, $name))
Truth table100%2/2
A
A= $self->app->config(join(".", "encoders", $self->encoder_name, $name))
Aresult
11
00
27 };
28 }
29  
30 sub get_encoder
31 117 ▶{
Subroutine get_encoder: called CC=3 SCAR=11.0
Pod undocumented
32 117 my ($self, $name) = @_;
33 117 ▶ $name //= 'default';
Condition100%2/2
$name //= "default"
l!l
6750
MC/DC100%1/1
$name //= "default"
$name
Truth table100%2/2
A
A= $name
Aresult
11
00
34  
35 117 ▶ return $self->encoders->{$name} //=
Condition66%2/3
$self->encoders->{$name} //= $self->build_encoder($self->get_encoder_config($name))
l!l&&r!l&&!r
59580
MC/DC0%0/2
$self->encoders->{$name} //= $self->build_encoder($self->get_encoder_config($name))
$self->encoders->{$name} $self->build_encoder($self->get_encoder_config($name))
Truth table66%2/3
A //= B
A= $self->encoders->{$name}B= $self->build_encoder($self->get_encoder_config($name))
ABresult
1X1
011
000
36 $self->build_encoder($self->get_encoder_config($name));
37 }
38  
39 36 1;
40  
41 __END__
« blib/lib/Kelp/Less.pm ↑ Summary blib/lib/Kelp/Exception.pm »