Date::Dump::Tree::Horizontal - wrap an object to render it horizontally
NAME
Date::Dump::Tree::Horizontal - wrap an object to render it horizontally
SYNOPSIS
# sub elements filter
sub ($d, $s, ($depth, $glyph, @renderings, $), @sub_elements)
{
if $depth == 2
{
my $total_width = $d.width - (($depth + 2 ) * 3) ;
@sub_elements =
(
(
'',
'',
# render the current element's data horizontally
Data::Dump::Tree::Horizontal.new(:dumper($d), :elements(@elements)),
),
)
}
}
See examples/horizontal in the distribution for multiple examples
Data::Dump::Tree::Horizontal renders the sub elements of the element it wraps separately, and aligns them horizontally.
# normal rendering of a List
(3) @0
โ 0 = 1.Int
โ 1 = 3.Int
โ 2 = 4.Int
# rendering wrapped in Data::Dump::Tree::Horizontal
(3) @0
0 = 1.Int 1 = 3.Int 2 = 4.Int
# normal rendering of a longer List
(4) @0
โ 0 = [2] @1
โ โ 0 = [2] @2
โ โ โ 0 = 1.Int
โ โ โ 1 = [2] @3
โ โ โ 0 = 2.Int
โ โ โ 1 = [2] @4
โ โ โ 0 = 3.Int
โ โ โ 1 = 4.Int
โ โ 1 = [2] ยง2
โ 1 = [2] @6
โ โ 0 = [3] @7
โ โ โ 0 = 1.Int
โ โ โ 1 = 2.Int
โ โ โ 2 = .Pair @8
โ โ โ k:3, v:[2] @9
โ โ โ 0 = 4.Int
โ โ โ 1 = 5.Int
โ โ 1 = .Seq(11) @10
โ โ 0 = [2] ยง2
โ โ 1 = [2] ยง2
โ โ 2 = [2] ยง2
โ โ 3 = [2] ยง2
โ โ 4 = [2] ยง2
โ โ 5 = [2] ยง2
โ โ 6 = [2] ยง2
โ โ 7 = [2] ยง2
โ โ 8 = [2] ยง2
โ โ 9 = [2] ยง2
โ โ ...
โ 2 = 12345678.Str
โ 3 = [2] ยง6
# rendering in horizontal layout
(4) @0
0 = [2] @1 1 = [2] @6 2 = 12345678.Str 3 = [2] ยง6
โ 0 = [2] @2 โ 0 = [3] @7
โ โ 0 = 1.Int โ โ 0 = 1.Int
โ โ 1 = [2] @3 โ โ 1 = 2.Int
โ โ 0 = 2.Int โ โ 2 = .Pair @8
โ โ 1 = [2] @4 โ โ k:3, v:[2] @9
โ โ 0 = 3.Int โ โ 0 = 4.Int
โ โ 1 = 4.Int โ โ 1 = 5.Int
โ 1 = [2] ยง2 โ 1 = .Seq(11) @10
โ 0 = [2] ยง2
โ 1 = [2] ยง2
โ 2 = [2] ยง2
โ 3 = [2] ยง2
โ 4 = [2] ยง2
โ 5 = [2] ยง2
โ 6 = [2] ยง2
โ 7 = [2] ยง2
โ 8 = [2] ยง2
โ 9 = [2] ยง2
โ ...
INTERFACE
method new: :element($s), [ :other_named_arguments, ...]
Arguments
:elements
The elements to wrap,they will be rendered horizontally, in columns
:title
Title to be displayed over the sub elements renderings
:total_width
The maximum width the horizontal rendering can take, the rendering will be wrapped into multiple rows
:rows
columnize the flattened output with this many rows in each column.
:dumper
The dumper to be used to render the sub elements, Passing a dumper allows the referenced to match between columns. You want to pass the dumper of the top container for the best results. A new dumper is created if this is not set.
:flat_depth
Options passed between renderers to handle lower renderers starting at depth zero while in the top rendering context they are at lower levels
AUTHOR
Nadim ibn hamouda el Khemir https://github.com/nkh
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl6 itself.
SEE-ALSO
Data::Dump::Tree
DDT::MultiColumns
) ; }