Given an object of type IO (respectively File), what is the easiest way
to see whether it is open for writing?

I could try to write the null string to the object and, if I get an
exception, assume that it is not writeable, but aside from the fact that
seems to be a rather crude way, it has the disadvantage that I can't
distinguish between an IO object does not allow writing, and one which
is open for writing, but where writing fails due to, say, a network
error.

-- 
Posted via http://www.ruby-forum.com/.