Output a hash with yaml : YAML « XML « Ruby






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



 








Related examples in the same category

1.YAML Demo
2.use YAML::dump to convert your Person object array into YAML data
3.Reading and Writing Configuration Files
4.Convert hash to configuration file
5.YAML for Marshaling