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         5  
  4         30  
3 4     4   19953 use MooseX::StrictConstructor;
  4         6  
  4         32  
4 4     4   9094 use Moose::Util::TypeConstraints;
  4         8  
  4         33  
5 4     4   5901 use namespace::autoclean;
  4         7  
  4         36  
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   8 my $self = shift;
20 4         11 my $content;
21 4         143 foreach my $de ( $self->directory_entries ) {
22 8         297 $content
23             .= $de->mode . ' '
24             . $de->filename . "\0"
25             . pack( 'H*', $de->sha1 );
26             }
27 4         125 $self->content($content);
28             }
29              
30             __PACKAGE__->meta->make_immutable;
31