File Coverage

blib/lib/Git/Database/Object/Raw.pm
Criterion Covered Total %
statement 5 5 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 3 3 100.0
pod 1 2 50.0
total 11 15 73.3


line stmt bran cond sub pod time code
1             package Git::Database::Object::Raw;
2             $Git::Database::Object::Raw::VERSION = '0.011';
3 7     7   72 use Moo;
  7         19  
  7         76  
4              
5             has kind => (
6             is => 'ro',
7             required => 1,
8             );
9              
10             with 'Git::Database::Role::Object';
11              
12             *sha1 = \&digest;
13              
14 26     26 1 11459 sub raw { $_[0]->kind . ' ' . $_[0]->size . "\0" . $_[0]->content }
15              
16             sub BUILDARGS {
17 26 50 33 26 0 4429 return @_ == 2 && eval { $_[1]->does('Git::Database::Role::Object') }
18             ? { kind => $_[1]->kind, content => $_[1]->content }
19             : Moo::Object::BUILDARGS(@_);
20             }
21              
22             1;
23              
24             __END__
25              
26             =pod
27              
28             =for Pod::Coverage
29             BUILDARGS
30             kind
31              
32             =head1 NAME
33              
34             Git::Database::Object::Raw - Raw Git::Database objects
35              
36             =head1 VERSION
37              
38             version 0.011
39              
40             =head1 SYNOPSIS
41              
42             # $object is-a Git::Database::Object (Blob, Tree, Commit, Tag)
43             my $raw = Git::Database::Object::Raw->new( $object );
44              
45             =head1 DESCRIPTION
46              
47             This tiny class adds the L</sha1> and L</raw> methods to those offered
48             by L<Git::Database::Role::Object>. Git::Database::Object::Raw objects
49             can be handed to L<Git::PurePerl::Loose> or L<Cogit::Loose> for saving
50             in the Git object database.
51              
52             =head1 METHODS
53              
54             =head2 sha1
55              
56             Alias for L<digest|Git::Database::Role::Object/digest>.
57              
58             =head2 raw
59              
60             Return the raw data, as used by L<Git::PurePerl::Loose> and
61             L<Cogit::Loose> to save an object in the Git object database.
62              
63             =head1 AUTHOR
64              
65             Philippe Bruhat (BooK) <book@cpan.org>
66              
67             =head1 COPYRIGHT
68              
69             Copyright 2016 Philippe Bruhat (BooK), all rights reserved.
70              
71             =head1 LICENSE
72              
73             This program is free software; you can redistribute it and/or modify it
74             under the same terms as Perl itself.
75              
76             =cut