| 1 | package Elastic::Model; | ||||||||||||||||||||||||||||
| 2 | 23 | $Elastic::Model::VERSION = '0.52'; | |||||||||||||||||||||||||||
| 3 | 23 | ▶ | use Moose 2.06 (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 23 | ▶ | use Moose::Exporter(); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 23 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 23 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 23 | Moose::Exporter->setup_import_methods( | |||||||||||||||||||||||||||
| 9 | class_metaroles => { class => ['Elastic::Model::Meta::Class::Model'] }, | ||||||||||||||||||||||||||||
| 10 | with_meta => [ | ||||||||||||||||||||||||||||
| 11 | qw(has_namespace has_typemap override_classes | ||||||||||||||||||||||||||||
| 12 | has_analyzer has_tokenizer has_filter has_char_filter | ||||||||||||||||||||||||||||
| 13 | has_unique_index) | ||||||||||||||||||||||||||||
| 14 | ], | ||||||||||||||||||||||||||||
| 15 | also => 'Moose', | ||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | #=================================== | ||||||||||||||||||||||||||||
| 19 | 23 | ▶ | sub init_meta { | ||||||||||||||||||||||||||
|
Subroutine
init_meta: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | #=================================== | ||||||||||||||||||||||||||||
| 21 | 23 | shift; | |||||||||||||||||||||||||||
| 22 | 23 | my $meta = Moose->init_meta(@_); | |||||||||||||||||||||||||||
| 23 | 23 | Moose::Util::apply_all_roles( $meta, 'Elastic::Model::Role::Model' ); | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | #=================================== | ||||||||||||||||||||||||||||
| 27 | 26 | ▶ | sub has_namespace { | ||||||||||||||||||||||||||
|
Subroutine
has_namespace: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | #=================================== | ||||||||||||||||||||||||||||
| 29 | 26 | my $meta = shift; | |||||||||||||||||||||||||||
| 30 | 26 | ▶ | my $name = shift or croak "No namespace name passed to namespace"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 26 | my %params = ( types => @_ ); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 26 | my $types = $params{types}; | |||||||||||||||||||||||||||
| 34 | 26 | ▶ | croak "No types specified for namespace $name" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$types and %$types
MC/DC0%0/2
$types and %$types
$types
%$types
Truth table33%1/3
A and B
A= $typesB= %$types
| |||||||||||||||||||||||||||||
| 35 | unless $types && %$types; | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 26 | $meta->add_namespace( $name => \%params ); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | #=================================== | ||||||||||||||||||||||||||||
| 41 | 11 | ▶ | sub has_typemap { shift->set_class( 'typemap', @_ ) } | ||||||||||||||||||||||||||
|
Subroutine
has_typemap: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 42 | #=================================== | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | #=================================== | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub has_unique_index { | ||||||||||||||||||||||||||
|
Subroutine
has_unique_index: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | #=================================== | ||||||||||||||||||||||||||||
| 47 | 0 | my ( $meta, $val ) = @_; | |||||||||||||||||||||||||||
| 48 | 0 | $meta->unique_index($val); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | #=================================== | ||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub override_classes { | ||||||||||||||||||||||||||
|
Subroutine
override_classes: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | #=================================== | ||||||||||||||||||||||||||||
| 54 | 0 | my $meta = shift; | |||||||||||||||||||||||||||
| 55 | 0 | ▶ | my %classes = ref $_[0] eq 'HASH' ? %{ shift() } : @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 0 | for ( keys %classes ) { | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | croak "Unknown arg for classes ($_)" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | unless $meta->get_class($_); | ||||||||||||||||||||||||||||
| 59 | 0 | $meta->set_class( $_ => $classes{$_} ); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | #=================================== | ||||||||||||||||||||||||||||
| 64 | 4 | ▶ | sub has_analyzer { | ||||||||||||||||||||||||||
|
Subroutine
has_analyzer: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | #=================================== | ||||||||||||||||||||||||||||
| 66 | 4 | ▶ | shift->add_analyzer( shift, ref $_[0] eq 'HASH' ? shift() : {@_} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | #=================================== | ||||||||||||||||||||||||||||
| 69 | 1 | ▶ | sub has_tokenizer { | ||||||||||||||||||||||||||
|
Subroutine
has_tokenizer: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | #=================================== | ||||||||||||||||||||||||||||
| 71 | 1 | ▶ | shift->add_tokenizer( shift, ref $_[0] eq 'HASH' ? shift() : {@_} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | #=================================== | ||||||||||||||||||||||||||||
| 74 | 2 | ▶ | sub has_filter { | ||||||||||||||||||||||||||
|
Subroutine
has_filter: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 75 | #=================================== | ||||||||||||||||||||||||||||
| 76 | 2 | ▶ | shift->add_filter( shift, ref $_[0] eq 'HASH' ? shift() : {@_} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | #=================================== | ||||||||||||||||||||||||||||
| 80 | 1 | ▶ | sub has_char_filter { | ||||||||||||||||||||||||||
|
Subroutine
has_char_filter: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | #=================================== | ||||||||||||||||||||||||||||
| 82 | 1 | ▶ | shift->add_char_filter( shift, ref $_[0] eq 'HASH' ? shift() : {@_} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 23 | 1; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | # ABSTRACT: A NoSQL document store with full text search for Moose objects using Elasticsearch as a backend. | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | __END__ | ||||||||||||||||||||||||||||