module FileTest

FileTest implements file test operations similar to those used in File::Stat.

instance methods

blockdev?
FileTest.blockdev?( aString ) → true or false
Returns true if the named file is a block device, false if it isn't or if the operating system doesn't support this feature.
FileTest.blockdev?( "testfile" ) false
chardev?
FileTest.chardev?( aString ) → true or false
Returns true if the named file is a character device, false if it isn't or if the operating system doesn't support this feature.
FileTest.chardev?( "/dev/tty" ) true
directory?
FileTest.directory?( aString ) → true or false
Returns true if this named file is a directory, false otherwise.
FileTest.directory?( "." ) true
executable?
FileTest.executable?( aString ) → true or false
Returns true if the named file is executable. The tests are made using the effective owner of the process.
FileTest.executable?( "testfile" ) false
executable_real?
FileTest.executable_real?( aString ) → true or false
Same as FileTest#executable?, but tests using the real owner of the process.
exist?
FileTest.exist? ( aString ) → true or false
Returns true if the named file exists.
FileTest.exist?( "testfile" ) true
exists?
FileTest.exists? ( aString ) → true or false
Synonym for FileTest::exist?.
file?
FileTest.file?( aString ) → true or false
Returns true if the named file is a regular file (not a device file, pipe, socket, etc.).
FileTest.file?( "testfile" ) true
grpowned?
FileTest.grpowned?( aString ) → true or false
Returns true if the effective group id of the process is the same as the group id of the named file. On Windows NT, returns false.
FileTest.grpowned?( "/etc/passwd" ) false
owned?
FileTest.owned?( aString ) → true or false
Returns true if the effective user id of the process is the same as the owner of the named file.
FileTest.owned?( "/etc/passwd" ) false
pipe?
FileTest.pipe?( aString ) → true or false
Returns true if the operating system supports pipes and the named file is a pipe, false otherwise.
FileTest.pipe?( "testfile" ) false
readable?
FileTest.readable?( aString ) → true or false
Returns true if the named file is readable by the effective user id of this process.
FileTest.readable?( "testfile" ) true
readable_real?
FileTest.readable_real?( aString ) → true or false
Returns true if the named file is readable by the real user id of this process.
FileTest.readable_real?( "testfile" ) true
setgid?
FileTest.setgid?( aString ) → true or false
Returns true if the named file's set-group-id permission bit is set, and false if it isn't or if the operating system doesn't support this feature.
FileTest.setgid?( "/usr/sbin/lpc" ) true
setuid?
FileTest.setuid?( aString ) → true or false
Returns true if the named file's set-user-id permission bit is set, and false if it isn't or if the operating system doesn't support this feature.
FileTest.setuid?( "/bin/su" ) true
size
FileTest.size( aString ) → anInteger
Returns the size of the named file in bytes.
FileTest.size( "testfile" ) 66
size?
FileTest.size?( aString ) → aFixnum or nil
Returns nil if the named file is of zero length; otherwise, returns a nonzero aFixnum.
FileTest.size?( "testfile" ) 66 FileTest.size?( "/dev/zero" ) nil
socket?
FileTest.socket?( aString ) → true or false
Returns true if the named file is a socket, false if it isn't or if the operating system doesn't support this feature.
sticky?
FileTest.sticky?( aString ) → true or false
Returns true if the named file has its sticky bit set, false if it doesn't or if the operating system doesn't support this feature.
FileTest.symlink?( aString ) → true or false
Returns true if the named file is a symbolic link, false if it isn't or if the operating system doesn't support this feature.
writable?
FileTest.writable?( aString ) → true or false
Returns true if the named file is writable by the effective user id of this process.
writable_real?
FileTest.writable_real?( aString ) → true or false
Returns true if the named file is writable by the real user id of this process.
zero?
FileTest.zero?( aString ) → true or false
Returns true if the named file is of zero length, false otherwise.
Show this content in its own window