From: Dave Aronson Date: 2011-12-05T11:27:55+09:00 Subject: Re: 'open().each' doesn't close file On Sun, Dec 4, 2011 at 08:19, Michael Fellinger wrote: > On Sun, Dec 4, 2011 at 1:47 PM, Mc Ben wrote: ... >>  open("test.txt","r").each do end  # doesn't close file >>  FileUtils.rm "test.txt"           # will fail: Permission denied ... > open will only close if you pass it a block directly. > > open('test.txt'){|file| file.each{ ... } } So just "do end" doesn't count as a block? Seems (at least to me) like it should, albeit not usually a very useful one.... -Dave -- LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages. Where: Northern Virginia, Washington DC (near Orange Line), and remote work. See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence). Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)