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   16 use Moose;
  4         5  
  4         22  
3 4     4   15764 use MooseX::StrictConstructor;
  4         4  
  4         26  
4 4     4   7275 use Moose::Util::TypeConstraints;
  4         5  
  4         30  
5 4     4   4742 use namespace::autoclean;
  4         5  
  4         30  
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   4 my $self = shift;
20 4         8 my $content;
21 4         105 foreach my $de ( $self->directory_entries ) {
22 8         198 $content
23             .= $de->mode . ' '
24             . $de->filename . "\0"
25             . pack( 'H*', $de->sha1 );
26             }
27 4         138 $self->content($content);
28             }
29              
30             __PACKAGE__->meta->make_immutable;
31