| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Git::PurePerl::NewObject::Commit; | 
| 2 | 4 |  |  | 4 |  | 15 | use Moose; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 21 |  | 
| 3 | 4 |  |  | 4 |  | 15685 | use MooseX::StrictConstructor; | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 24 |  | 
| 4 | 4 |  |  | 4 |  | 7432 | use Moose::Util::TypeConstraints; | 
|  | 4 |  |  |  |  | 6 |  | 
|  | 4 |  |  |  |  | 28 |  | 
| 5 | 4 |  |  | 4 |  | 4793 | use DateTime; | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 74 |  | 
| 6 | 4 |  |  | 4 |  | 16 | use namespace::autoclean; | 
|  | 4 |  |  |  |  | 6 |  | 
|  | 4 |  |  |  |  | 24 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | extends 'Git::PurePerl::NewObject'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has 'kind' => | 
| 11 |  |  |  |  |  |  | ( is => 'ro', isa => 'ObjectKind', required => 1, default => 'commit' ); | 
| 12 |  |  |  |  |  |  | has 'tree'   => ( is => 'rw', isa => 'Str',                  required => 1 ); | 
| 13 |  |  |  |  |  |  | has 'parent' => ( is => 'rw', isa => 'Str|ArrayRef[Str]',    required => 0 ); | 
| 14 |  |  |  |  |  |  | has 'author' => ( is => 'rw', isa => 'Git::PurePerl::Actor', required => 1 ); | 
| 15 |  |  |  |  |  |  | has 'authored_time' => ( is => 'rw', isa => 'DateTime', required => 1 ); | 
| 16 |  |  |  |  |  |  | has 'committer' => | 
| 17 |  |  |  |  |  |  | ( is => 'rw', isa => 'Git::PurePerl::Actor', required => 1 ); | 
| 18 |  |  |  |  |  |  | has 'committed_time' => ( is => 'rw', isa => 'DateTime', required => 1 ); | 
| 19 |  |  |  |  |  |  | has 'comment'        => ( is => 'rw', isa => 'Str',      required => 1 ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | sub _build_content { | 
| 22 | 4 |  |  | 4 |  | 5 | my $self = shift; | 
| 23 | 4 |  |  |  |  | 3 | my $content; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 4 |  |  |  |  | 108 | $content .= 'tree ' . $self->tree . "\n"; | 
| 26 | 4 | 100 |  |  |  | 106 | if ( my $parent = $self->parent ) { | 
| 27 | 2 | 50 |  |  |  | 6 | if ( ref $parent ) { | 
| 28 | 0 |  |  |  |  | 0 | $content .= "parent $_\n" for @$parent; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  | else { | 
| 31 | 2 |  |  |  |  | 8 | $content .= "parent $parent\n"; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  | $content | 
| 35 | 4 |  |  |  |  | 103 | .= "author " | 
| 36 |  |  |  |  |  |  | . $self->author->name . ' <' | 
| 37 |  |  |  |  |  |  | . $self->author->email . "> " | 
| 38 |  |  |  |  |  |  | . $self->authored_time->epoch . " " | 
| 39 |  |  |  |  |  |  | . DateTime::TimeZone->offset_as_string( $self->authored_time->offset ) | 
| 40 |  |  |  |  |  |  | . "\n"; | 
| 41 | 4 |  |  |  |  | 382 | $content | 
| 42 |  |  |  |  |  |  | .= "committer " | 
| 43 |  |  |  |  |  |  | . $self->committer->name . ' <' | 
| 44 |  |  |  |  |  |  | . $self->author->email . "> " | 
| 45 |  |  |  |  |  |  | . $self->committed_time->epoch . " " | 
| 46 |  |  |  |  |  |  | . DateTime::TimeZone->offset_as_string( | 
| 47 |  |  |  |  |  |  | $self->committed_time->offset ) | 
| 48 |  |  |  |  |  |  | . "\n"; | 
| 49 | 4 |  |  |  |  | 166 | $content .= "\n"; | 
| 50 | 4 |  |  |  |  | 112 | my $comment = $self->comment; | 
| 51 | 4 |  |  |  |  | 9 | chomp $comment; | 
| 52 | 4 |  |  |  |  | 11 | $content .= "$comment\n"; | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 4 |  |  |  |  | 92 | $self->content($content); | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 58 |  |  |  |  |  |  |  |