Format a blob of code?

There's often the case that I get a blob of Ruby code from the console, and I want it to be formatted nicely for maximum readability. For example:
{:daterange=>[{:start=>Thu, 15 Aug 2013 00:00:00 +0000, :end=>Wed, 21 Aug 2013 00:00:00 +0000}, {:start=>Fri, 23 Aug 2013 00:00:00 +0000, :end=>Tue, 27 Aug 2013 00:00:00 +0000}], :stats=>[{:total_units=>1234, ...

I would like to format this to:
{
  :daterange=>[
    {
      :start=>Thu, 15 Aug 2013 00:00:00 +0000,
      :end=>Wed, 21 Aug 2013 00:00:00 +0000
    },
    {
      :start=>Fri, 23 Aug 2013  00:00:00 +0000,
      :end=>Tue, 27 Aug 2013 00:00:00 +0000
    }
  ],
  ...

Code -> Reformat Code looks like the most likely candidate, but it doesn't break up my blob into multiple lines with nice indentation.

What can I do?

Please sign in to leave a comment.