On 12/04/2011 06:27 PM, Dave Aronson wrote:
> On Sun, Dec 4, 2011 at 08:19, Michael Fellinger<m.fellinger / gmail.com>  wrote:
>> On Sun, Dec 4, 2011 at 1:47 PM, Mc Ben<viertelvor12 / gmx.net>  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....

In your case, the "do end" block is passed to the #each call, not to the 
#open call.