Skip to content

Instantly share code, notes, and snippets.

@marktabler
Created May 22, 2012 22:43
Show Gist options
  • Save marktabler/2772100 to your computer and use it in GitHub Desktop.
Save marktabler/2772100 to your computer and use it in GitHub Desktop.
A quick and dirty hash beautifier
def self.pretty_hash(hash)
results = []
hash.keys.each do |key|
results << key
if hash[key].respond_to?(:keys)
results << pretty_hash(hash[key]).split("\n").map do | line |
" -- " + line
end
end
end
results.join("\n")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment