[Bps-public-commit] Path-Dispatcher branch, complete, updated. ca495a52aec12c6ff6077903a6109afcc0886080
sartak at bestpractical.com
sartak at bestpractical.com
Fri Dec 18 19:08:57 EST 2009
The branch, complete has been updated
via ca495a52aec12c6ff6077903a6109afcc0886080 (commit)
via 5178ffc5ff4cead6f7d1dee4b4757296b30196da (commit)
from 7f66ddf66a1d3a0f4908d96a9a4d5669db2788ea (commit)
Summary of changes:
lib/Path/Dispatcher/Rule/Under.pm | 4 +++-
t/301-complete-complex.t | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 5178ffc5ff4cead6f7d1dee4b4757296b30196da
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Dec 18 19:08:32 2009 -0500
Add the prefix back in when we complete an Under
diff --git a/lib/Path/Dispatcher/Rule/Under.pm b/lib/Path/Dispatcher/Rule/Under.pm
index eb31198..f0350bf 100644
--- a/lib/Path/Dispatcher/Rule/Under.pm
+++ b/lib/Path/Dispatcher/Rule/Under.pm
@@ -48,7 +48,9 @@ sub complete {
my $new_path = $path->clone_path($prefix_match->leftover);
- return map { $_->complete($new_path) } $self->rules;
+ my $prefix = substr($path->path, 0, length($path->path) - length($new_path->path));
+
+ return map { "$prefix$_" } map { $_->complete($new_path) } $self->rules;
}
sub readable_attributes { shift->predicate->readable_attributes }
commit ca495a52aec12c6ff6077903a6109afcc0886080
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Dec 18 19:08:45 2009 -0500
complete returns full paths
diff --git a/t/301-complete-complex.t b/t/301-complete-complex.t
index 641b526..53db089 100644
--- a/t/301-complete-complex.t
+++ b/t/301-complete-complex.t
@@ -32,7 +32,7 @@ do {
my $dispatcher = MyApp::Dispatcher->dispatcher;
is_deeply([$dispatcher->complete('x')], [], 'no completions for "x"');
is_deeply([$dispatcher->complete('a')], ['alpha'], 'one completion for "a"');
-is_deeply([$dispatcher->complete('alpha')], ['one', 'two', 'three'], 'three completions for "alpha"');
+is_deeply([$dispatcher->complete('alpha')], ['alpha one', 'alpha two', 'alpha three'], 'three completions for "alpha"');
is_deeply([$dispatcher->complete('q')], ['quux'], 'one completion for "quux"');
is_deeply([$dispatcher->complete('bet')], ['beta'], 'one completion for "beta"');
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list