Colorize debug output
I found myself printing a bunch of debugging statements to the console and I couldn't tell where one line ended and the next began. I was using something like this:
pp thing
I modified that to colorize the output based on the thing's object ID, which is more or less random.
puts "\033[3#{thing.object_id % 8}m#{thing.inspect}\033[0m"
Written by Taylor Fausak
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#