Is there a way to quickly print a ruby hash in a table format into a file?
Such as:
keyA keyB keyC ...
123 234 345
125 347
4456
...
where the values of the hash are arrays of different sizes. Or is using a double loop the only way?
Thanks
Here’s a version of steenslag’s that works when the arrays aren’t the same size:
nilseems like a reasonable placeholder for missing values but you can, of course, use whatever makes sense.For example: