--- trunk/lib/Frey/Class/Graph.pm 2009/01/10 01:03:28 981 +++ trunk/lib/Frey/Class/Graph.pm 2009/01/10 01:27:28 982 @@ -13,9 +13,37 @@ is => 'rw', isa => 'Str', required => 1, - default => 'Frey', + default => sub { + '(' . join('|', map { s{lib/}{}; $_ } sort grep { -d $_ } glob("lib/*") ) . ')' + }, ); + +has filter_class => ( + is => 'rw', + isa => 'Bool', + default => 1, +); + +has filter_extends => ( + is => 'rw', + isa => 'Bool', + default => 1, +); + +has filter_includes => ( + is => 'rw', + isa => 'Bool', + default => 1, +); + +has filter_roles => ( + is => 'rw', + isa => 'Bool', + default => 1, +); + + has show_extends => ( documentation => 'connect to superclasses', is => 'rw', @@ -40,6 +68,7 @@ isa => 'Bool', ); + has portrait => ( documentation => 'vertical layout', is => 'rw', @@ -95,12 +124,12 @@ my $data = $self->load( $path ); # warn "## $class $path ", $self->dump( $data ); # if $self->debug; - next if $filter && $class !~ m{$filter}; + next if $filter && $self->filter_class && $class !~ m{$filter}; if ( $self->show_includes && defined $data->{includes} ) { foreach my $type ( keys %{ $data->{includes} } ) { foreach my $package ( @{ $data->{includes}->{$type} } ) { - next if $filter && $package !~ m{$filter}; + next if $filter && $self->filter_includes && $package !~ m{$filter}; warn "# $class\t$type\t$package\n"; $g->add_edge( $class => $package, label => $type, color => 'blue' ); $count->{$class}++; @@ -111,7 +140,7 @@ if ( $self->show_roles && defined $data->{roles} ) { foreach my $role ( keys %{ $data->{roles} } ) { - next if $filter && $role !~ m{$filter}; + next if $filter && $self->filter_roles && $role !~ m{$filter}; warn "# $class\trole\t$role\n"; $g->add_edge( $role => $class, label => 'role', color => 'yellow' ); # $g->add_node( $role, rank => 'role' ); @@ -122,7 +151,7 @@ if ( $self->show_extends && defined $data->{superclass} ) { foreach my $extends ( keys %{ $data->{superclass} } ) { - next if $filter && $extends !~ m{$filter}; + next if $filter && $self->filter_extends && $extends !~ m{$filter}; warn "# $class\textends\t$extends\n"; $g->add_edge( $extends => $class, label => 'extends', color => 'green' ); $count->{$class}++;