blib/lib/ElasticSearchX/Model/Trait/Class.pm

filter: Statementstmt 75.0% 18 / 24 Branchbran 50.0% 2 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 60.0% 24 / 40 CC 3 SCAR 15.9
CC
3
Cov
65%
__ANON__
12.0
__ANON__
2.0
__ANON__
2.0
CRAP 4.9
« blib/lib/ElasticSearchX/Model/Document/Mapping.pm ↑ Summary Build »
1 #
2 # This file is part of ElasticSearchX-Model
3 #
4 # This software is Copyright (c) 2018 by Moritz Onken.
5 #
6 # This is free software, licensed under:
7 #
8 # The (three-clause) BSD License
9 #
10 package ElasticSearchX::Model::Trait::Class;
11 1 $ElasticSearchX::Model::Trait::Class::VERSION = '1.0.3';
12 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use List::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 sub _handles {
17 4 ▶ my ( $s, $p ) = @_;
Subroutine _handles: called CC=1 SCAR=0.0
18 return {
19 4 "get_$s" => 'get',
20 "get_$p" => 'values',
21 "get_${s}_list" => 'keys',
22 "remove_$s" => 'delete',
23 "add_$s" => 'set',
24 };
25 }
26 1 my %foo = (
27 analyzer => 'analyzers',
28 tokenizer => 'tokenizers',
29 filter => 'filters'
30 );
31 1 ▶while ( my ( $s, $p ) = each %foo ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %foo) 3 1 4
32 has $p => (
33 traits => ['Hash'],
34 isa => 'HashRef',
35 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 3 handles => _handles( $s, $p )
37 );
38 }
39  
40 has indices => (
41 traits => ['Hash'],
42 isa => 'HashRef',
43 0 ▶ default => sub { { default => {} } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
44 1 handles => _handles( 'index', 'indices' )
45 );
46  
47 before add_index => sub {
48 0 ▶ my ( $self, $name, $index ) = @_;
Subroutine __ANON__: not called CC=3 SCAR=24.8
49 0 $self->remove_index('default');
50 0 ▶ if ( $index->{alias_for} && $name ne $index->{alias_for} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index->{"alias_for"} and $name ne $index->{"alias_for"}) 0 0 0
Condition0%0/3
$index->{"alias_for"} and $name ne $index->{"alias_for"}
!ll&&!rl&&r
000
MC/DC0%0/2
$index->{"alias_for"} and $name ne $index->{"alias_for"}
$index->{"alias_for"} $name ne $index->{"alias_for"}
Truth table0%0/3
A and B
A= $index->{"alias_for"}B= $name ne $index->{"alias_for"}
ABresult
0X0
100
111
51 0 return $self->add_index( $index->{alias_for}, $index );
52 }
53 1 };
54  
55 1 1;
56  
57 __END__
58  
59 =pod
60  
61 =encoding UTF-8
62  
63 =head1 NAME
64  
65 ElasticSearchX::Model::Trait::Class
66  
67 =head1 VERSION
68  
69 version 1.0.3
70  
71 =head1 AUTHOR
72  
73 Moritz Onken
74  
75 =head1 COPYRIGHT AND LICENSE
76  
77 This software is Copyright (c) 2018 by Moritz Onken.
78  
79 This is free software, licensed under:
80  
81 The (three-clause) BSD License
82  
83 =cut
« blib/lib/ElasticSearchX/Model/Document/Mapping.pm ↑ Summary Build »