Ruby Inspect readability?

The ruby standard library contains PP (short for “Pretty Print”), which formats structures much better than the standard inspect:

http://www.ruby-doc.org/stdlib/libdoc/pp/rdoc/index.html

You need to require 'pp' at the top of your source file before you can use it, and then just replace p obj with pp obj in your code.

I find it really useful for hashes and arrays in particular!

Leave a Comment