Human Readable Hash Inspection w/ Vertical Display

This gem adds a human_inspect() method to the Ruby Hash object that returns a Ruby Hash inspection String with a vertical display, something more easily readable by humans (like me), when the Hash is larger than a few keys.

puts myhash.human_inspect
{
  :whatever => {
    :whatever => {
      :two => "two",
      :another => {
        :and => "and",
        :more => "more"
      },
      :array => [0, 1, 2],
      :one => "one",
      :bool => true
    }
  },
  2 => "two",
  4 => "four"
}

human_inspect() will display String keys as symbols by default, but only because this is my personal preference. To show String keys as Strings add false to the method call: puts myhash.human_inspect(false).

Copyright © 2010 Eric Woodward. See LICENSE for details. ejw.com.