[Bps-public-commit] Path-Dispatcher-Debugger branch, master, updated. 536f1a42fa2f231432ed5d9ffc2552e0c1c5df40
sartak at bestpractical.com
sartak at bestpractical.com
Wed Dec 23 16:05:14 EST 2009
The branch, master has been updated
via 536f1a42fa2f231432ed5d9ffc2552e0c1c5df40 (commit)
from a7c22a0207c43acdd15f554777800ef383bcf5e0 (commit)
Summary of changes:
lib/Path/Dispatcher/Debugger/View.pm | 41 +++++++++++++--------------------
1 files changed, 16 insertions(+), 25 deletions(-)
- Log -----------------------------------------------------------------
commit 536f1a42fa2f231432ed5d9ffc2552e0c1c5df40
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Wed Dec 23 16:05:06 2009 -0500
Refactor to kill duplication
diff --git a/lib/Path/Dispatcher/Debugger/View.pm b/lib/Path/Dispatcher/Debugger/View.pm
index f1e6ca6..644d88d 100644
--- a/lib/Path/Dispatcher/Debugger/View.pm
+++ b/lib/Path/Dispatcher/Debugger/View.pm
@@ -101,10 +101,10 @@ template matching_rules => sub {
};
h3 { "\u$type-matching: $path" };
- if ($type eq 'completion') {
- my @matches;
- my @not_matches;
+ my @matches;
+ my @unmatches;
+ if ($type eq 'completion') {
my $path_object = $debugger->dispatcher->path_class->new($path);
for my $rule ($debugger->dispatcher->rules) {
my @completions = $rule->complete($path_object);
@@ -112,35 +112,26 @@ template matching_rules => sub {
push @matches, { rule => $rule, completions => \@completions };
}
else {
- push @not_matches, $rule;
+ push @unmatches, $rule;
}
}
-
- h5 { "Matched Rules" };
- div {
- class is 'matched_rules';
- display_rules(@matches);
- }
- h5 { "Unmatched Rules" };
- div {
- class is 'unmatched_rules';
- display_rules(@not_matches);
- }
}
else {
my $dispatch = $debugger->dispatcher->dispatch($path);
my %seen = map { $_ => 1 } map { $_->rule } $dispatch->matches;
+ @matches = grep { $seen{$_} } $debugger->dispatcher->rules;
+ @unmatches = grep { !$seen{$_} } $debugger->dispatcher->rules;
+ }
- h5 { "Matched Rules" };
- div {
- class is 'matched_rules';
- display_rules(grep { $seen{$_} } $debugger->dispatcher->rules);
- }
- h5 { "Unmatched Rules" };
- div {
- class is 'unmatched_rules';
- display_rules(grep { !$seen{$_} } $debugger->dispatcher->rules);
- }
+ h5 { "Matched Rules" };
+ div {
+ class is 'matched_rules';
+ display_rules(@matches);
+ }
+ h5 { "Unmatched Rules" };
+ div {
+ class is 'unmatched_rules';
+ display_rules(@unmatches);
}
};
};
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list