forked from beyondgrep/ack2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Is.pm
52 lines (36 loc) · 843 Bytes
/
Is.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
package App::Ack::Filter::Is;
use strict;
use warnings;
use base 'App::Ack::Filter';
use File::Spec 3.00 ();
use App::Ack::Filter::IsGroup;
sub new {
my ( $class, $filename ) = @_;
return bless {
filename => $filename,
groupname => 'IsGroup',
}, $class;
}
sub create_group {
return App::Ack::Filter::IsGroup->new();
}
sub filter {
my ( $self, $resource ) = @_;
my $filename = $self->{'filename'};
my $base = (File::Spec->splitpath($resource->name))[2];
return $base eq $filename;
}
sub inspect {
my ( $self ) = @_;
my $filename = $self->{'filename'};
return ref($self) . " - $filename";
}
sub to_string {
my ( $self ) = @_;
my $filename = $self->{'filename'};
return $filename;
}
BEGIN {
App::Ack::Filter->register_filter(is => __PACKAGE__);
}
1;