File Coverage

blib/lib/Git/PurePerl/NewObject/Tree.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Git::PurePerl::NewObject::Tree;
2 4     4   18 use Moose;
  4         4  
  4         23  
3 4     4   16734 use MooseX::StrictConstructor;
  4         6  
  4         29  
4 4     4   7806 use Moose::Util::TypeConstraints;
  4         8  
  4         29  
5 4     4   4942 use namespace::autoclean;
  4         8  
  4         32  
6              
7             extends 'Git::PurePerl::NewObject';
8              
9             has 'kind' =>
10             ( is => 'ro', isa => 'ObjectKind', required => 1, default => 'tree' );
11             has 'directory_entries' => (
12             is => 'rw',
13             isa => 'ArrayRef[Git::PurePerl::NewDirectoryEntry]',
14             required => 1,
15             auto_deref => 1,
16             );
17              
18             sub _build_content {
19 4     4   6 my $self = shift;
20 4         7 my $content;
21 4         107 foreach my $de ( $self->directory_entries ) {
22 8         199 $content
23             .= $de->mode . ' '
24             . $de->filename . "\0"
25             . pack( 'H*', $de->sha1 );
26             }
27 4         92 $self->content($content);
28             }
29              
30             __PACKAGE__->meta->make_immutable;
31