[Bps-public-commit] r16940 - in Path-Dispatcher/trunk: lib/Path/Dispatcher/Rule

sartak at bestpractical.com sartak at bestpractical.com
Wed Nov 19 16:59:13 EST 2008


Author: sartak
Date: Wed Nov 19 16:59:13 2008
New Revision: 16940

Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Dispatch.pm
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Eq.pm
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Metadata.pm
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Regex.pm
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Under.pm

Log:
 r75835 at onn:  sartak | 2008-11-19 16:59:06 -0500
 Begin giving rules readable_attributes


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Dispatch.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Dispatch.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Dispatch.pm	Wed Nov 19 16:59:13 2008
@@ -17,6 +17,8 @@
     return $dispatch->matches;
 }
 
+sub readable_attributes { shift->dispatcher->name }
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 no Moose::Util::TypeConstraints;

Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Eq.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Eq.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Eq.pm	Wed Nov 19 16:59:13 2008
@@ -16,6 +16,8 @@
     return $path->path eq $self->string;
 }
 
+sub readable_attributes { q{"} . shift->string . q{"} }
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 

Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Metadata.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Metadata.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Metadata.pm	Wed Nov 19 16:59:13 2008
@@ -28,5 +28,15 @@
     return 1, $path->path;
 }
 
+sub readable_attributes {
+    my $self = shift;
+    return sprintf "{ '%s': %s }",
+        $self->name,
+        $self->matcher->readable_attributes;
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
 1;
 

Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Regex.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Regex.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Regex.pm	Wed Nov 19 16:59:13 2008
@@ -26,6 +26,8 @@
     return \@matches;
 }
 
+sub readable_attributes { shift->regex }
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 

Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Under.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Under.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Under.pm	Wed Nov 19 16:59:13 2008
@@ -30,6 +30,8 @@
     return grep { defined } map { $_->match($new_path) } $self->rules;
 }
 
+sub readable_attributes { shift->predicate->readable_attributes }
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 no Moose::Util::TypeConstraints;



More information about the Bps-public-commit mailing list