Skip to content

Commit 967b34e

Browse files
committed
add doc method to MetaCPAN::Model
Allows getting a "type" object from a document name rather than needing to specify an index and type.
1 parent aff19bf commit 967b34e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/MetaCPAN/Model.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ for my $index ( sort keys %indexes ) {
3737
index $index => %{ $indexes{$index} };
3838
}
3939

40+
sub doc {
41+
my ( $self, $doc ) = @_;
42+
my $doc_config = es_config->documents->{$doc};
43+
return $self->index( $doc_config->{index} )->type( $doc_config->{type} );
44+
}
45+
4046
__PACKAGE__->meta->make_immutable;
4147
1;
4248

0 commit comments

Comments
 (0)