From: Gennady Date: 2004-01-07T09:04:06+09:00 Subject: Re: File checks.... GGarramuno wrote: > Is there anything in Ruby similar to Perl's if -r, -x, etc. switches? > These switches work with variables as if they were files and they are > used in simple, silent and quick constructs like: > if -r $file { > print "$file is readable\n"; > } > > Or am I forced to write all the code of File.new() and handle the > rescue exceptions myself? > Check out methods of module FileTest p FileTest.methods). Class File extends this module, so you can write: File.readable? "afile" If "aFile" does not exist, File.readable? returns false. Gennady.