File Coverage

blib/lib/Tree/Visualize/ASCII/Node/PlainBox.pm
Criterion Covered Total %
statement 18 18 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 26 96.1


line stmt bran cond sub pod time code
1              
2             package Tree::Visualize::ASCII::Node::PlainBox;
3              
4 3     3   1241 use strict;
  3         9  
  3         151  
5 3     3   19 use warnings;
  3         8  
  3         96  
6              
7 3     3   16 use Tree::Visualize::Exceptions;
  3         70  
  3         138  
8              
9             our $VERSION = '0.01';
10              
11 3     3   17 use base qw(Tree::Visualize::Node::INode);
  3         6  
  3         1876  
12              
13             sub draw {
14 31     31 1 42 my ($self) = @_;
15 31         92 my $node_value = $self->{tree}->getNodeValue();
16 31 50       157 ($node_value !~ /\n/)
17             || throw Tree::Visualize::IllegalOperation "node value has a newline in it, this is currently not supported.";
18 31         79 my $top = "+" . ("-" x (length($node_value) + 2)) . "+";
19 31         49 my $bottom = "+" . ("-" x (length($node_value) + 2)) . "+";
20 31         134 return "$top\n| $node_value |\n$bottom";
21             }
22              
23             1;
24              
25             __END__