[Bps-public-commit] Path-Dispatcher branch, complete, updated. b030e4d46e9ec28153a6c928585c94227eeda2a2

sartak at bestpractical.com sartak at bestpractical.com
Fri Dec 18 18:15:50 EST 2009


The branch, complete has been updated
       via  b030e4d46e9ec28153a6c928585c94227eeda2a2 (commit)
      from  cd6e2c20ccb9e7e2f5e931fcb7665be02e063a9f (commit)

Summary of changes:
 lib/Path/Dispatcher.pm |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit b030e4d46e9ec28153a6c928585c94227eeda2a2
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Dec 18 18:15:15 2009 -0500

    When we try to complete on a dispatcher, let each rule have at it

diff --git a/lib/Path/Dispatcher.pm b/lib/Path/Dispatcher.pm
index 422e0c9..88ac7ba 100644
--- a/lib/Path/Dispatcher.pm
+++ b/lib/Path/Dispatcher.pm
@@ -70,12 +70,17 @@ sub run {
 }
 
 sub complete {
-    my $self  = shift;
-    my $start = shift;
+    my $self = shift;
+    my $path = shift;
 
-    my @completions;
+    # Automatically box paths
+    unless (blessed($path) && $path->isa('Path::Dispatcher::Path')) {
+        $path = $self->path_class->new(
+            path => $path,
+        );
+    }
 
-    return @completions;
+    return map { $_->complete($path) } $self->rules;
 }
 
 # We don't export anything, so if they request something, then try to error

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list