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

sartak at bestpractical.com sartak at bestpractical.com
Wed Nov 19 17:02:55 EST 2008


Author: sartak
Date: Wed Nov 19 17:02:53 2008
New Revision: 16941

Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Metadata.pm
   Path-Dispatcher/trunk/t/018-metadata.t
   Path-Dispatcher/trunk/t/019-intersection-metadata.t

Log:
 r75838 at onn:  sartak | 2008-11-19 17:02:46 -0500
 Rename the metadata key from "name" to "field" because "name" is now used for all rules


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 17:02:53 2008
@@ -4,7 +4,7 @@
 use MooseX::AttributeHelpers;
 extends 'Path::Dispatcher::Rule';
 
-has name => (
+has field => (
     is       => 'rw',
     isa      => 'Str',
     required => 1,
@@ -19,7 +19,7 @@
 sub _match {
     my $self = shift;
     my $path = shift;
-    my $got = $path->get_metadata($self->name);
+    my $got = $path->get_metadata($self->field);
 
     # wow, offensive.. but powerful
     my $faux_path = Path::Dispatcher::Path->new(path => $got);
@@ -31,7 +31,7 @@
 sub readable_attributes {
     my $self = shift;
     return sprintf "{ '%s': %s }",
-        $self->name,
+        $self->field,
         $self->matcher->readable_attributes;
 }
 

Modified: Path-Dispatcher/trunk/t/018-metadata.t
==============================================================================
--- Path-Dispatcher/trunk/t/018-metadata.t	(original)
+++ Path-Dispatcher/trunk/t/018-metadata.t	Wed Nov 19 17:02:53 2008
@@ -9,7 +9,7 @@
 my $dispatcher = Path::Dispatcher->new(
     rules => [
         Path::Dispatcher::Rule::Metadata->new(
-            name    => "http_method",
+            field   => "http_method",
             matcher => Path::Dispatcher::Rule::Eq->new(string => "GET"),
             block   => sub { push @calls, $_ },
         ),

Modified: Path-Dispatcher/trunk/t/019-intersection-metadata.t
==============================================================================
--- Path-Dispatcher/trunk/t/019-intersection-metadata.t	(original)
+++ Path-Dispatcher/trunk/t/019-intersection-metadata.t	Wed Nov 19 17:02:53 2008
@@ -14,7 +14,7 @@
                     tokens    => ['=', 'model', 'Ticket'],
                 ),
                 Path::Dispatcher::Rule::Metadata->new(
-                    name    => 'http_method',
+                    field   => 'http_method',
                     matcher => Path::Dispatcher::Rule::Eq->new(string => 'POST'),
                 ),
             ],



More information about the Bps-public-commit mailing list