I have some text boxes into which i want to output the contents of some
hashes, in the nice readable way we all know and love. Can i use
pretty-print for this? As far as i can tell, pp only works to standard
output and can’t be used to create text.
Is there another way to nicely print out the contents of a hash?
I have some text boxes into which i want to output the contents of some
hashes, in the nice readable way we all know and love. Can i use
pretty-print for this? As far as i can tell, pp only works to standard
output and can’t be used to create text.
Is there another way to nicely print out the contents of a hash?
thanks!
max
I actually found out how to do this from another post somewhere - you
can get the output of pp into a string with
text = PP.pp(myhash, “”)
The resultant string has any quotes inside it escaped out.