From: Ezra Zygmuntowicz Date: 2005-12-23T17:27:24+09:00 Subject: Re: Ruby version of UMENU > > Curious -- just how much YAML support does Ruby give the programmer? > > Thanks > > SteveT > Steve- Ruby has great support for YAML its basically all parsed for you. Here's a little irb session to show you. The "y" command is just like the 'p' command you use to inspect an object. The 'y' just pretty prints to yaml format: ezras-powerbook-g4-17:~/Desktop/rimport root# irb >> require 'yaml' => true >> hash = {:name => 'Steve Litt', :list => 'rubytalk', :topic => 'UMENU'} => {:list=>"rubytalk", :topic=>"UMENU", :name=>"Steve Litt"} >> y hash --- :list: rubytalk :topic: UMENU :name: Steve Litt => nil >> array = %w{ one two three four five six } => ["one", "two", "three", "four", "five", "six"] >> y array --- - one - two - three - four - five - six => nil >> x = YAML::dump_stream array => "--- \n- one\n- two\n- three\n- four\n- five\n- six" There is plenty more goodness in there like yaml dumping your custom ruby objects. There are a few limitations though, mainly you cannot dump any code with procs or lambdas in them because they can't be serialized to yaml. Cheers- -Ezra