[Bps-public-commit] Path-Dispatcher-Debugger branch, master, updated. 2a7fb8691b2854dd96b822d5933642d43043bfae
sartak at bestpractical.com
sartak at bestpractical.com
Wed Dec 23 15:47:31 EST 2009
The branch, master has been updated
via 2a7fb8691b2854dd96b822d5933642d43043bfae (commit)
from 31f37e61afdbd03bf8d9155350be0dfd95256d2a (commit)
Summary of changes:
lib/Path/Dispatcher/Debugger/View.pm | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 2a7fb8691b2854dd96b822d5933642d43043bfae
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Dec 23 15:47:00 2009 -0500
More completion-display refactoring
diff --git a/lib/Path/Dispatcher/Debugger/View.pm b/lib/Path/Dispatcher/Debugger/View.pm
index 59e89cd..06ee39e 100644
--- a/lib/Path/Dispatcher/Debugger/View.pm
+++ b/lib/Path/Dispatcher/Debugger/View.pm
@@ -101,7 +101,7 @@ template matching_rules => sub {
for my $rule ($debugger->dispatcher->rules) {
my @completions = $rule->complete($path_object);
if (@completions) {
- push @matches, [$rule, join ', ', @completions];
+ push @matches, { rule => $rule, completions => \@completions };
}
else {
push @not_matches, $rule;
@@ -136,10 +136,13 @@ sub display_rules {
}
sub display_rule {
- my ($rule) = @_;
+ my $rule = shift;
my $extra;
- ($rule, $extra) = @$rule if ref($rule) eq 'ARRAY';
+ if (ref($rule) eq 'HASH') {
+ $extra = $rule;
+ $rule = delete $extra->{rule};
+ }
if ($rule->isa('Path::Dispatcher::Rule::Tokens')) {
tt { $rule->readable_attributes };
@@ -158,7 +161,20 @@ sub display_rule {
outs blessed($rule);
}
- span { $extra } if defined $extra;
+ if ($extra->{completions}) {
+ display_completions(@{ $extra->{completions} });
+ }
+}
+
+sub display_completions {
+ my @completions = @_;
+
+ span {
+ while (my $c = shift @completions) {
+ span { attr { class => 'completion' } $c };
+ span { ', ' } if @completions;
+ }
+ }
}
1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list