Skip to content

Commit

Permalink
Added field "dir" to File, so that MetaCPAN::Web::Model::API::File::d…
Browse files Browse the repository at this point in the history
…ir()

no longer needs to use the prefix filter.
  • Loading branch information
clintongormley committed Apr 18, 2015
1 parent 661a626 commit f66ae99
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/MetaCPAN/Document/File.pm
Expand Up @@ -575,6 +575,22 @@ sub _build_path {
return join( '/', $self->release->name, $self->name );
}

has dir => (
is => 'ro',
lazy_build => 1,
isa => 'Str',
required => 1,
index => 'not_analyzed'
);

sub _build_dir {
my $self = shift;
$DB::single = 1;
my $dir = $self->path;
$dir =~ s{/[^/]+$}{};
return $dir;
}

has [qw(release distribution)] => (
is => 'ro',
required => 1,
Expand Down

0 comments on commit f66ae99

Please sign in to comment.