File Coverage

lib/App/GitFind/Entry/PathClass.pm
Criterion Covered Total %
statement 23 32 71.8
branch 0 4 0.0
condition n/a
subroutine 8 10 80.0
pod 2 2 100.0
total 33 48 68.7


line stmt bran cond sub pod time code
1             # App::GitFind::Entry::PathClass - App::GitFind::Entry wrapper for an App::GitFind::PathClassMicro::Entity instance
2             package App::GitFind::Entry::PathClass;
3              
4 1     1   1357 use 5.010;
  1         3  
5 1     1   4 use strict;
  1         1  
  1         17  
6 1     1   4 use warnings;
  1         2  
  1         19  
7 1     1   4 use App::GitFind::Base;
  1         2  
  1         139  
8             #use Path::Class;
9 1     1   6 use App::GitFind::PathClassMicro;
  1         1  
  1         39  
10              
11             our $VERSION = '0.000002';
12              
13 1     1   5 use parent 'App::GitFind::Entry';
  1         2  
  1         4  
14              
15             # Fields. Not all have values.
16             use Class::Tiny
17 1     1   52 'obj'; # An App::GitFind::PathClassMicro::Entity instance. Required.
  1         1  
  1         5  
18             use Class::Tiny::Immutable {
19 0           '_lstat' => sub { [$_[0]->obj->lstat()] },
20              
21 0           isdir => sub { $_[0]->obj->is_dir },
22 0           name => sub { $_[0]->obj->basename },
23 0           path => sub { $_[0]->obj->relative($_[0]->searchbase) },
24              
25 1     1   353 };
  1         2  
  1         57  
26              
27             # Docs {{{1
28              
29             =head1 NAME
30              
31             # App::GitFind::Entry::PathClass - App::GitFind::Entry wrapper for an App::GitFind::PathClassMicro::Entity instance
32              
33             =head1 SYNOPSIS
34              
35             This represents a single file or directory being checked against an expression.
36             This particular concrete class represents a file or directory on disk.
37             It requires a L<File::Find::Object::Result> instance. Usage:
38              
39             use App::GitFind::PathClassMicro;
40             my $obj = App::GitFind::PathClassMicro::File->new('foo.txt');
41             # or ...::Dir->new('bar')
42             my $entry = App::GitFind::Entry::PathClass->new(-obj => $obj);
43              
44             =head1 METHODS
45              
46             =cut
47              
48             # }}}1
49              
50             =head2 prune
51              
52             TODO
53              
54             =cut
55              
56             sub prune {
57             ...
58 0     0 1   }
59              
60             =head2 BUILD
61              
62             Enforces the requirements on the C<-obj> argument to C<new()>.
63              
64             =cut
65              
66             sub BUILD {
67 0     0 1   my $self = shift;
68 0 0         die "Usage: @{[ref $self]}->new(-obj=>...)"
  0            
69             unless $self->obj;
70 0 0         die "-obj must be a App::GitFind::PathClassMicro::Entity"
71             unless $self->obj->DOES('App::GitFind::PathClassMicro::Entity');
72             } #BUILD()
73              
74             1;