Mega Code Archive

 
Categories / Ruby / Hash
 

Print a hash with PP module

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