Print out a nested hash : Print Hash « Hash « Ruby






Print out a nested hash


require 'pp'


h = {}
h[:name] = "Robert"
h[:nickname] = "Bob"
h[:age] = 43
h[:email_addresses] = {:home => "bob@example.com",
                       :work => "robert@example.com"}

PP::pp(h, $stderr, 50)


 








Related examples in the same category

1.using puts on a hash in Ruby doesn't result in as nice a display as it does for arrays
2.Printing a Hash
3.Print a hash with PP module