From: Hal Fulton Date: 2004-03-15T12:29:35+09:00 Subject: Re: YAML questions why the lucky stiff wrote: > Hal Fulton wrote: >> 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. Yes, I see that. It's just that 1. I don't really want to explicitly do File.open or File.read all the time 2. In the case of #open above, note that the file is not closed until GC (correct?) Personally, I want methods that keep the File stuff enclosed inside. I have my own, and they're trivial, but you know how it is. :) Actually, I wouldn't mind it for Marshal either, but that sounds more like an RCR (instead of a _wCR). And thanks for the inline collections ref. Cheers, Hal