Array.inspect
returns its output in a flat line:
aoa = [ [1,2,3], [4,5,6] ]
puts aoa.inspect # => [[1, 2, 3], [4, 5, 6]]
Is there an easy way to get an indented output instead? The exact format (e.g., whether there is a line break after the first [
) is not important to me. I just would like to have it more readable.
Compare Perl:
DB<2> print Dumper([[1,2,3],[4,5,6]])
$VAR1 = [
[
1,
2,
3
],
[
4,
5,
6
]
];
The solution should support hashes as well and handle other things gracefully.