Ruby on Rails: pretty print for variable.hash_set.inspect ... is there a way to pretty print .inpsect in the console?

Viewed 13625

I findy myself doing a lot of puts .inpsect s in my functional testing to make sure I know how the data is formatted... but hashes are hard to read when there is no new lines after each entry in a hash object. Is there anyway, maybe a gem?, to pretty print hashes?

So that it looks something like this:

{ 
  entry1 => { 
              entrey1.1 => 1,
              entry1.2 => 3
            },
  entry2 => 3
}

instead of: { entry1 => { entrey1.1 => 1, entry1.2 => 3}, entry2 => 3 } ?

Thanks!

2 Answers
Related