« lib/Git/PurePerl/Walker/OnCommit/List.pm
↑ Summary
lib/Git/PurePerl/Walker/Method/FirstParent/FromHEAD.pm »
| 1 | 5 | ▶ | use 5.008; # utf8 | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 5 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | package Git::PurePerl::Walker::Method::FirstParent; | ||||||||||
| 7 | |||||||||||
| 8 | 5 | our $VERSION = '0.004000'; | |||||||||
| 9 | |||||||||||
| 10 | # ABSTRACT: Walk down a tree following the first parent. | ||||||||||
| 11 | |||||||||||
| 12 | 5 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||
| 13 | |||||||||||
| 14 | 5 | ▶ | use Moose qw( with has ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | 5 | with qw( Git::PurePerl::Walker::Role::Method ); | |||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | |||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | |||||||||||
| 51 | |||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | 5 | has '_commit' => ( isa => 'Maybe[ Object ]', is => 'rw', lazy_build => 1 ); | |||||||||
| 57 | 5 | has 'start' => ( isa => 'Str', is => 'rw', required => 1 ); | |||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | |||||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | sub _build__commit { | ||||||||||
| 64 | 2 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_build__commit: called CC=1 SCAR=0.0
| |||||||||||
| 65 | 2 | return $self->_repo->get_object( $self->start ); | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | |||||||||||
| 72 | |||||||||||
| 73 | |||||||||||
| 74 | sub current { | ||||||||||
| 75 | 6 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
current: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 76 | 6 | return $self->_commit; | |||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | |||||||||||
| 80 | |||||||||||
| 81 | |||||||||||
| 82 | |||||||||||
| 83 | |||||||||||
| 84 | |||||||||||
| 85 | sub has_next { | ||||||||||
| 86 | 6 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
has_next: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||
| 87 | 6 | ▶ | if ( not $self->_commit ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | 0 | return; | |||||||||
| 89 | } | ||||||||||
| 90 | 6 | ▶ | if ( not $self->_commit->parent ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 91 | 3 | return; | |||||||||
| 92 | } | ||||||||||
| 93 | 3 | return 1; | |||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | |||||||||||
| 97 | |||||||||||
| 98 | |||||||||||
| 99 | |||||||||||
| 100 | |||||||||||
| 101 | |||||||||||
| 102 | ## no critic (Subroutines::ProhibitBuiltinHomonyms) | ||||||||||
| 103 | sub next { | ||||||||||
| 104 | 3 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
next: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 105 | 3 | my $commit; | |||||||||
| 106 | 3 | $self->_commit( $commit = $self->peek_next ); | |||||||||
| 107 | 3 | return $commit; | |||||||||
| 108 | } | ||||||||||
| 109 | ## use critic | ||||||||||
| 110 | |||||||||||
| 111 | |||||||||||
| 112 | |||||||||||
| 113 | |||||||||||
| 114 | |||||||||||
| 115 | |||||||||||
| 116 | |||||||||||
| 117 | sub peek_next { | ||||||||||
| 118 | 5 | ▶ | my $commit = (shift)->_commit->parent; | ||||||||
|
Subroutine
peek_next: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 119 | 5 | return $commit; | |||||||||
| 120 | } | ||||||||||
| 121 | |||||||||||
| 122 | |||||||||||
| 123 | |||||||||||
| 124 | |||||||||||
| 125 | |||||||||||
| 126 | |||||||||||
| 127 | |||||||||||
| 128 | ## no critic ( Subroutines::ProhibitBuiltinHomonyms ) | ||||||||||
| 129 | sub reset { | ||||||||||
| 130 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 131 | 1 | $self->_commit( $self->_repo->get_object( $self->start ) ); | |||||||||
| 132 | 1 | return $self; | |||||||||
| 133 | } | ||||||||||
| 134 | ## use critic | ||||||||||
| 135 | |||||||||||
| 136 | 5 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 137 | 5 | __PACKAGE__->meta->make_immutable; | |||||||||
| 138 | 5 | 1; | |||||||||
| 139 | |||||||||||
| 140 | __END__ | ||||||||||
| 141 | |||||||||||
| 142 | =pod | ||||||||||
| 143 | |||||||||||
| 144 | =encoding UTF-8 | ||||||||||
| 145 | |||||||||||
| 146 | =head1 NAME | ||||||||||
| 147 | |||||||||||
| 148 | Git::PurePerl::Walker::Method::FirstParent - Walk down a tree following the first parent. | ||||||||||
| 149 | |||||||||||
| 150 | =head1 VERSION | ||||||||||
| 151 | |||||||||||
| 152 | version 0.004000 | ||||||||||
| 153 | |||||||||||
| 154 | =head1 CONSTRUCTOR ARGUMENTS | ||||||||||
| 155 | |||||||||||
| 156 | =head2 start | ||||||||||
| 157 | |||||||||||
| 158 | =head1 ATTRIBUTES | ||||||||||
| 159 | |||||||||||
| 160 | =head2 start | ||||||||||
| 161 | |||||||||||
| 162 | =head1 ATTRIBUTE GENERATED METHODS | ||||||||||
| 163 | |||||||||||
| 164 | =head2 start | ||||||||||
| 165 | |||||||||||
| 166 | =head1 INHERITED METHODS | ||||||||||
| 167 | |||||||||||
| 168 | =head2 for_repository | ||||||||||
| 169 | |||||||||||
| 170 | L<< C<Git::PurePerl::B<Walker::Role::HasRepo>-E<gt>I<for_repository( $repo )>>|Git::PurePerl::Walker::Role::HasRepo/for_repository >> | ||||||||||
| 171 | |||||||||||
| 172 | =head2 clone | ||||||||||
| 173 | |||||||||||
| 174 | L<< C<MooseX::B<Clone>-E<gt>I<clone( %params )>>|MooseX::Clone/clone-params >> | ||||||||||
| 175 | |||||||||||
| 176 | =head2 _repo | ||||||||||
| 177 | |||||||||||
| 178 | L<< C<Git::PurePerl::B<Walker::Role::HasRepo>-E<gt>I<_repo( $repo )>>|Git::PurePerl::Walker::Role::HasRepo/_repo >> | ||||||||||
| 179 | |||||||||||
| 180 | =head1 PRIVATE CONSTRUCTOR ARGUMENTS | ||||||||||
| 181 | |||||||||||
| 182 | =head2 _commit | ||||||||||
| 183 | |||||||||||
| 184 | =head1 PRIVATE ATTRIBUTES | ||||||||||
| 185 | |||||||||||
| 186 | =head2 _commit | ||||||||||
| 187 | |||||||||||
| 188 | =head1 PRIVATE METHODS | ||||||||||
| 189 | |||||||||||
| 190 | =head2 _build_commit | ||||||||||
| 191 | |||||||||||
| 192 | =head1 PRIVATE ATTRIBUTE GENERATED METHODS | ||||||||||
| 193 | |||||||||||
| 194 | =head2 _commit | ||||||||||
| 195 | |||||||||||
| 196 | =head1 CONSUMED ROLES | ||||||||||
| 197 | |||||||||||
| 198 | =head2 Git::PurePerl::Walker::Role::Method | ||||||||||
| 199 | |||||||||||
| 200 | L<< C<Git::PurePerl::B<Walker::Role::Method>>|Git::PurePerl::Walker::Role::Method >> | ||||||||||
| 201 | |||||||||||
| 202 | =head1 ROLE SATISFYING METHODS | ||||||||||
| 203 | |||||||||||
| 204 | =head2 current | ||||||||||
| 205 | |||||||||||
| 206 | L<< C<Git::PurePerl::B<Walker::Role::Method>-E<gt>I<current()>>|Git::PurePerl::Walker::Role::Method/current >> | ||||||||||
| 207 | |||||||||||
| 208 | =head2 has_next | ||||||||||
| 209 | |||||||||||
| 210 | L<< C<Git::PurePerl::B<Walker::Role::Method>-E<gt>I<has_next()>>|Git::PurePerl::Walker::Role::Method/has_next >> | ||||||||||
| 211 | |||||||||||
| 212 | =head2 next | ||||||||||
| 213 | |||||||||||
| 214 | L<< C<Git::PurePerl::B<Walker::Role::Method>-E<gt>I<next()>>|Git::PurePerl::Walker::Role::Method/next >> | ||||||||||
| 215 | |||||||||||
| 216 | =head2 peek_next | ||||||||||
| 217 | |||||||||||
| 218 | L<< C<Git::PurePerl::B<Walker::Role::Method>-E<gt>I<peek_next()>>|Git::PurePerl::Walker::Role::Method/peek_next >> | ||||||||||
| 219 | |||||||||||
| 220 | =head2 reset | ||||||||||
| 221 | |||||||||||
| 222 | L<< C<Git::PurePerl::B<Walker::Role::Method>-E<gt>I<reset()>>|Git::PurePerl::Walker::Role::Method/reset >> | ||||||||||
| 223 | |||||||||||
| 224 | =head1 AUTHOR | ||||||||||
| 225 | |||||||||||
| 226 | Kent Fredric <kentnl@cpan.org> | ||||||||||
| 227 | |||||||||||
| 228 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 229 | |||||||||||
| 230 | This software is copyright (c) 2014 by Kent Fredric <kentnl@cpan.org>. | ||||||||||
| 231 | |||||||||||
| 232 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 233 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 234 | |||||||||||
| 235 | =cut | ||||||||||