line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
15
|
use strictures 1; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
67
|
|
2
|
|
|
|
|
|
|
package Mojito::Model::Doc; |
3
|
|
|
|
|
|
|
{ |
4
|
|
|
|
|
|
|
$Mojito::Model::Doc::VERSION = '0.24'; |
5
|
|
|
|
|
|
|
} |
6
|
3
|
|
|
3
|
|
2042
|
use Mojito::Model::Doc::Mongo; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Mojito::Model::Doc::Deep; |
8
|
|
|
|
|
|
|
use Mojito::Model::Doc::Elasticsearch; |
9
|
|
|
|
|
|
|
use Moo; |
10
|
|
|
|
|
|
|
use Data::Dumper::Concise; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has 'doc' => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
lazy => 1, |
15
|
|
|
|
|
|
|
writer => '_set_doc', |
16
|
|
|
|
|
|
|
handles => [ qw( get_most_recent_docs get_feed_docs get_collections get_collection_pages get_docs_for_month) ], |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub BUILD { |
20
|
|
|
|
|
|
|
my ($self, $constructor_args_href) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Determine the document store backend from the configuration |
23
|
|
|
|
|
|
|
my $doc_storage = ucfirst lc $constructor_args_href->{config}->{document_storage}; |
24
|
|
|
|
|
|
|
my $delegatee = __PACKAGE__ . '::' . $doc_storage; |
25
|
|
|
|
|
|
|
$self->_set_doc($delegatee->new($constructor_args_href)); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |