From: why the lucky stiff Date: 2004-03-15T05:16:29+09:00 Subject: Re: YAML questions Hal Fulton wrote: > First of all, are there guidelines somewhere for writing YAML > manually? I can't figure out how to put hashes/arrays in a > single line instead of multiple lines. (I got the idea this was > possible somehow.) you've seen the Cookbook? [1] see the section on inline collections [2] for examples. yikes, i just noticed this is missing from the docs. [3] i will fix. > Also, why don't we have #load_file and #dump_file or something > of that nature? I frequently find myself doing: > > obj = nil > File.open("filename") {|f| obj = YAML.load(f) } > YAML::load and YAML::dump both accept IO objects of any kind: obj = YAML::load( File.open( "filename" ) ) to dump: YAML::dump( obj, File.open( "filename2" ) ) follows Marshal's API. please ask all you like, i'm interested to know where documentation is lacking (working on ri docs today) and what is tripping up any of you from slathering your scripts in YAML. _why [1] http://yaml4r.sourceforge.net/cookbook/ [2] http://yaml4r.sourceforge.net/cookbook/#inline_collections [3] http://yaml4r.sourceforge.net/doc/