-
Notifications
You must be signed in to change notification settings - Fork 138
Expand file tree
/
Copy pathIsPathGroup.pm
More file actions
56 lines (35 loc) · 802 Bytes
/
IsPathGroup.pm
File metadata and controls
56 lines (35 loc) · 802 Bytes
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
53
54
55
56
package App::Ack::Filter::IsPathGroup;
=head1 NAME
App::Ack::Filter::IsPathGroup
=head1 DESCRIPTION
The App::Ack::Filter::IsPathGroup class optimizes multiple ::IsPath
calls into one container. See App::Ack::Filter::IsGroup for details.
=cut
use strict;
use warnings;
use base 'App::Ack::Filter';
sub new {
my ( $class ) = @_;
return bless {
data => {},
}, $class;
}
sub add {
my ( $self, $filter ) = @_;
$self->{data}->{ $filter->{filename} } = 1;
return;
}
sub filter {
my ( $self, $resource ) = @_;
my $data = $self->{'data'};
return exists $data->{$resource->name};
}
sub inspect {
my ( $self ) = @_;
return ref($self) . " - $self";
}
sub to_string {
my ( $self ) = @_;
return join(' ', keys %{$self->{data}});
}
1;