File Coverage

blib/lib/Forest/Tree/Writer/SimpleASCII.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Forest::Tree::Writer::SimpleASCII;
2 4     4   8286 use Moose;
  4         14  
  4         46  
3              
4             our $VERSION = '0.10';
5             our $AUTHORITY = 'cpan:STEVAN';
6              
7             with 'Forest::Tree::Writer',
8             'Forest::Tree::Roles::HasNodeFormatter';
9              
10             sub as_string {
11 12     12 1 3520 my ($self) = @_;
12 12         25 my $out;
13              
14 90         325 return join( "", map { "$_\n" }
15             $self->tree->fmap_cont(sub {
16 102     102   354 my ( $t, $cont, %args ) = @_;
17              
18 102 100       5146 if ( $t->has_node ) {
19             return (
20 59         766 $self->format_node($t),
21 90         330 map { " $_" } $cont->(),
22             );
23             } else {
24 12         44 return $cont->();
25             }
26 12         523 }),
27             );
28             }
29              
30             __PACKAGE__->meta->make_immutable;
31              
32 4     4   58215 no Moose; 1;
  4         13  
  4         27  
33              
34             __END__
35              
36             =pod
37              
38             =head1 NAME
39              
40             Forest::Tree::Writer::SimpleASCII - A simple ASCII writer for Forest::Tree heirarchies
41              
42             =head1 DESCRIPTION
43              
44             This is a simple writer which draws a tree in ASCII.
45              
46             =head1 METHODS
47              
48             =over 4
49              
50             =item B<as_string>
51              
52             =back
53              
54             =head1 BUGS
55              
56             All complex software has bugs lurking in it, and this module is no
57             exception. If you find a bug please either email me, or add the bug
58             to cpan-RT.
59              
60             =head1 AUTHOR
61              
62             Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
63              
64             =head1 COPYRIGHT AND LICENSE
65              
66             Copyright 2008-2014 Infinity Interactive, Inc.
67              
68             L<http://www.iinteractive.com>
69              
70             This library is free software; you can redistribute it and/or modify
71             it under the same terms as Perl itself.
72              
73             =cut