File Coverage

blib/lib/ElasticSearchX/Model/Document/Trait/Field/ID.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             #
2             # This file is part of ElasticSearchX-Model
3             #
4             # This software is Copyright (c) 2016 by Moritz Onken.
5             #
6             # This is free software, licensed under:
7             #
8             # The (three-clause) BSD License
9             #
10             package ElasticSearchX::Model::Document::Trait::Field::ID;
11             $ElasticSearchX::Model::Document::Trait::Field::ID::VERSION = '1.0.2';
12 7     7   10476 use Moose::Role;
  7         11  
  7         42  
13 7     7   23311 use ElasticSearchX::Model::Document::Types qw(:all);
  7         10  
  7         48  
14              
15             has id => (
16             is => 'rw',
17             isa => 'ArrayRef|Bool',
18             );
19              
20             after install_accessors => sub {
21             my $self = shift;
22             return
23             unless (
24             $self->associated_class->does_role(
25             'ElasticSearchX::Model::Document::Role')
26             );
27             $self->associated_class->_add_reverse_field_alias( _id => $self->name );
28             $self->associated_class->_id_attribute($self);
29             };
30              
31             package ElasticSearchX::Model::Document::Trait::Class::ID;
32             $ElasticSearchX::Model::Document::Trait::Class::ID::VERSION = '1.0.2';
33 7     7   3800 use Moose::Role;
  7         8  
  7         28  
34              
35             1;
36              
37             __END__
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             ElasticSearchX::Model::Document::Trait::Field::ID
46              
47             =head1 VERSION
48              
49             version 1.0.2
50              
51             =head1 AUTHOR
52              
53             Moritz Onken
54              
55             =head1 COPYRIGHT AND LICENSE
56              
57             This software is Copyright (c) 2016 by Moritz Onken.
58              
59             This is free software, licensed under:
60              
61             The (three-clause) BSD License
62              
63             =cut