Skip to content

Instantly share code, notes, and snippets.

@leaniman
Created April 17, 2013 08:21
Show Gist options
  • Save leaniman/5402652 to your computer and use it in GitHub Desktop.
Save leaniman/5402652 to your computer and use it in GitHub Desktop.
Print hash indented
def self.print_hash(hash, level)
hash.each do |k,v|
text = "#{"--"*level} #{k} (#{v.class})"
if v.is_a?(Hash)
p text
print_hash(v, (level+1))
else
p "#{text} => #{v}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment