Data/Parser/YAML.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 97.3% 37 / 38 CC 2 SCAR 2.0
CC
2
Cov
100%
get_value
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Data/Parser/JSON.pm ↑ Summary Data/Parser/CSV.pm »
1 package Feed::Data::Parser::YAML;
2  
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 extends 'Feed::Data::Parser::Base';
5 1 ▶use Compiled::Params::OO qw/cpo/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Types::Standard qw/Object HashRef Str/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use YAML::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $validate;
10 BEGIN {
11 1 ▶ $validate = cpo(
Subroutine BEGIN: called CC=1 SCAR=0.0
12 get_value => [Object, HashRef, Str],
13 );
14 }
15  
16 has '+parser' => (
17 default => sub {
18 1 ▶ my $self = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
19 1 my $content = $self->content_ref;
20 1 my $matches = YAML::XS::Load $$content;
21 1 return { items => $matches };
22 },
23 1 );
24  
25 has '+potential_fields' => (
26 default => sub {
27 return {
28 1 ▶ title => 'title',
Subroutine __ANON__: called CC=1 SCAR=0.0
29 description => 'description',
30 date => 'date',
31 author => 'author',
32 category => 'category',
33 permalink => 'permalink',
34 comment => 'comment',
35 link => 'link',
36 content => 'content',
37 image => 'image',
38 };
39 },
40 1 );
41  
42 sub get_value {
43 22 ▶ my ($self, $item, $action) = $validate->get_value->(@_);
Subroutine get_value: called CC=2 SCAR=6.9
Pod undocumented
44 22 my $value = $item->{$action};
45 22 ▶ return $value // '';
Condition100%2/2
$value // ""
l!l
139
MC/DC100%1/1
$value // ""
$value
Truth table100%2/2
A
A= $value
Aresult
11
00
46 }
47  
48 1 1; # End of Data::Feed
« Data/Parser/JSON.pm ↑ Summary Data/Parser/CSV.pm »