From: Todd Benson Date: 2008-03-16T07:37:51+09:00 Subject: Re: baffling undefined method error - addendum On Sat, Mar 15, 2008 at 8:33 AM, Tom Cloyd wrote: > Tom Cloyd wrote: > > I'm getting an error I can't account for. In a method I've written I > > open a file and access a yaml store: > > > > archive_stored_list = 'archive_stored_list.yml' > > archives_stored_catalog = File.open(archive_stored_list) {|i| > > YAML.load(i)} > > > > I massage the data a bit, and want to write it back out to the same > > file. I try to close the file so I can open it for output, but get an > > error: > > > > archives_stored_catalog.close # <= "undefined method `close'" error is > > written to log file here > > open(archive_stored_list,"w") {|i| YAML.dump(archives_stored_catalog,i)} > > The File.open block version automagically closes the file. Todd