Permalink
Browse files

Implement to_string for most filters

  • Loading branch information...
1 parent 5744e36 commit 051059e497802b63a370d54c190d363f0dd85d09 @hoelzro hoelzro committed Jun 12, 2012
Showing with 30 additions and 0 deletions.
  1. +8 −0 Extension.pm
  2. +8 −0 FirstLineMatch.pm
  3. +6 −0 Is.pm
  4. +8 −0 Match.pm
View
@@ -32,6 +32,14 @@ sub inspect {
return ref($self) . " - $re";
}
+sub to_string {
+ my ( $self ) = @_;
+
+ my $exts = $self->{'extensions'};
+
+ return join(' ', map { ".$_" } @{$exts});
+}
+
BEGIN {
App::Ack::Filter->register_filter(ext => __PACKAGE__);
}
View
@@ -39,6 +39,14 @@ sub inspect {
return ref($self) . " - $re";
}
+sub to_string {
+ my ( $self ) = @_;
+
+ my $re = $self->{'regex'};
+
+ return "first line matches $re";
+}
+
BEGIN {
App::Ack::Filter->register_filter(firstlinematch => __PACKAGE__);
}
View
6 Is.pm
@@ -31,6 +31,12 @@ sub inspect {
return ref($self) . " - $filename";
}
+sub to_string {
+ my ( $self ) = @_;
+
+ my $filename = $self->{'filename'};
+}
+
BEGIN {
App::Ack::Filter->register_filter(is => __PACKAGE__);
}
View
@@ -34,6 +34,14 @@ sub inspect {
print ref($self) . " - $re";
}
+sub to_string {
+ my ( $self ) = @_;
+
+ my $re = $self->{'regex'};
+
+ return "filename matches $re";
+}
+
BEGIN {
App::Ack::Filter->register_filter(match => __PACKAGE__);
}

0 comments on commit 051059e

Please sign in to comment.