--- trunk/lib/Frey/ClassBrowser.pm 2008/09/13 15:31:54 187
+++ trunk/lib/Frey/ClassBrowser.pm 2008/11/18 12:55:32 408
@@ -1,40 +1,43 @@
package Frey::ClassBrowser;
use Moose;
-extends 'Frey';
-with 'Frey::Web';
+extends 'Frey::ClassLoader';
-use Frey::ClassLoader;
+use Frey::Run;
our $markup;
sub markup {
+ my $self = shift;
return $markup if $markup;
- my $f = Frey::ClassLoader->new;
my $html;
- foreach my $package ( $f->classes ) {
- $html .= qq|
$package | |;
- if ( $package->can('meta') ) {
- if ( $package->meta->isa('Moose::Meta::Role') ) {
+ foreach my $class ( $self->classes ) {
+ $html .= qq| |
$class | |;
+ if ( $class->can('meta') ) {
+ if ( $class->meta->isa('Moose::Meta::Role') ) {
$html .= qq|role|;
} else {
- $html .= qq|design| if $package->can('collection');
+ $html .= qq|design| if $class->can('collection');
}
}
- my @inspect;
- push @inspect, qq|collection| if $package->can('collection_table');
- push @inspect, qq|markup| if $package->can('markup');
- push @inspect, qq|html| if $package->can('html');
- $html .= qq| | | . join(' ', @inspect) . qq| |
|;
+ my @run;
+ my @input;
+ push @run, qq|collection| if $class->can('collection_table');
+ my @methods = $self->class_methods( $class );
+ foreach my $try ( Frey::Run->runnable ) {
+ next unless $class->can($try);
+ if ( grep { /^\Q$try\E$/ } @methods ) {
+ push @run, qq|$try|;
+ } else {
+ push @input, $try;
+ }
+ }
+ $html .= qq|| . join(' ', @run) . qq| | | .
+ ( @input ? '← ' . join(' ', @input) : '' ) .
+ qq| | |;
}
$html = "" if $html;
$markup = $html;
}
-sub html {
- my ( $self, $req ) = @_;
- my $html = $self->page( body => qq|Classes
| . $self->markup );
- $req->print( $html );
-}
-
1;