π’ PlaceMaker | 25% off for February including new Google Earth data imports!
Learn more
Print Arrays, Hashes etc in a readable format?
-
Is there a way to output an Array, Hash etc in the Console in a more readable way?
So that items are listed on each their line and indents as the object nests? -
myarray.sort.join("\n") from the console works great.
For hashes, take your pick of .each, each_key, each_pair, and so on.
Read up on the Enumerable class.
-
Ok. I was just checking that there wasn't a built-in function that printed objects, like what you get in PHP with print_r.
Advertisement