File Coverage

blib/lib/Rubyish/Syntax/def.pm
Criterion Covered Total %
statement 15 15 100.0
branch 3 4 75.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 21 23 91.3


line stmt bran cond sub pod time code
1             package Rubyish::Syntax::def;
2              
3 18     18   24391 use base 'Devel::Declare::MethodInstaller::Simple';
  18         28  
  18         1671  
4              
5             sub import {
6 43     43   96 my $class = shift;
7 43         97 my $caller = caller;
8              
9 43         68 my $arg = shift;
10              
11 43         236 $class->install_methodhandler(
12             into => $caller,
13             name => 'def',
14             );
15             }
16              
17             sub parse_proto {
18 22     22 0 8628 my $ctx = shift;
19 22         65 my ($proto) = @_;
20 22         44 my $inject = 'my ($self';
21 22 100       97 if (defined $proto) {
22 8 50       48 $inject .= ", $proto" if length($proto);
23 8         27 $inject .= ') = @_; ';
24             }
25             else {
26 14         72 $inject .= ') = shift;';
27             }
28 22         85 return $inject;
29             }
30              
31             1;
32              
33             __END__