Wirble is an enhancement to irb that gives you syntax coloring.
It also loads a few gems automatically, such as pp and irb/completion;
doing this also enhances irb, obviously.
However, if you’re into the syntax coloring, and you want to use pp,
too bad – because with pp, you lose the syntax coloring. Also, there
isn’t a configuration option to set pp output as the default.
I thought it’d be easy to add both these things, but it turned out
slightly harder than I thought. The core of pp is a separate library
called prettyprint.rb, and it looks as if it’s written to flush
directly to a stream. As far as I can tell, it doesn’t appear to have
any obvious hooks which I can use to just get the reformatted string,
bypass the whole buffer thing, and pass the string to Wirble’s
However, I’m actually almost certain that I must be wrong about that.
The unit tests inside prettyprint.rb appear to consistently use string
comparisons, and they wouldn’t be able to do that unless the output
could be extracted as a string.
I just e-mailed the author of pp and prettyprint, but if anybody out
there has a good idea where I should begin, let me know!