From: Rob Biedenharn Date: 2007-06-19T23:10:08+09:00 Subject: Re: When file gets closed in a block On Jun 19, 2007, at 5:52 AM, Damjan Rems wrote: >> You can write as often as you like to f as long as you don't close >> it. >> >> File#open closes the file automatically if passed a block: >> >> --- >> File.open('someFilename', 'w') {|f| >> f.write(text1) >> f.write(text2) >> } > > I guess then my one liner should look like this: > > File.new(cName,'wb+') { |f|.write('aText') } > > by > TheR Close, try it like this: File.open(cName,'wb+') { |f| f.write('aText') } -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com