Giampiero Zanchi wrote:
> You could use exceptions

I thought the OP was interested in whether *another* process had the 
same file open.

If you just want to test whether a Ruby File object is closed, there is 
a 'closed?' method.

irb(main):002:0> f = File.open("/etc/passwd")
=> #<File:/etc/passwd>
irb(main):003:0> f.closed?
=> false
irb(main):004:0> f.close
=> nil
irb(main):005:0> f.closed?
=> true
-- 
Posted via http://www.ruby-forum.com/.