Mega Code Archive

 
Categories / Ruby / XML
 

Output a hash with yaml

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