File Coverage

blib/lib/ElasticSearchX/Model/Document/Trait/Field/TTL.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 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) 2019 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::TTL;
11             $ElasticSearchX::Model::Document::Trait::Field::TTL::VERSION = '2.0.1';
12 4     4   2186 use Moose::Role;
  4         8  
  4         34  
13 4     4   20646 use ElasticSearchX::Model::Document::Types qw(:all);
  4         10  
  4         33  
14              
15             has ttl => (
16             is => 'rw',
17             isa => TTLField,
18             coerce => 1,
19             predicate => 'has_ttl',
20             );
21              
22             around mapping => sub { () };
23              
24             around type_mapping => sub {
25             my ( $orig, $self ) = @_;
26             my $default = $self->default($self);
27             return ( _ttl => $self->ttl );
28             };
29              
30             around field_name => sub {'_ttl'};
31              
32             around property => sub {0};
33              
34             1;
35              
36             __END__
37              
38             =pod
39              
40             =encoding UTF-8
41              
42             =head1 NAME
43              
44             ElasticSearchX::Model::Document::Trait::Field::TTL
45              
46             =head1 VERSION
47              
48             version 2.0.1
49              
50             =head1 AUTHOR
51              
52             Moritz Onken
53              
54             =head1 COPYRIGHT AND LICENSE
55              
56             This software is Copyright (c) 2019 by Moritz Onken.
57              
58             This is free software, licensed under:
59              
60             The (three-clause) BSD License
61              
62             =cut