FileTest
is the collection of the file test
functions. It can be used for inclusion.
blockdev?(file)
Returns true if the file specified by the file is the block special file.
chardev?(file)
Returns true if the file specified by the file is the character special file.
executable?(filename)
Returns true if the file specified by the filename is executable by the effective user/group id.
executable_real?(filename)
Returns true if the file specified by the filename is executable by the real user/group id.
exist?(file)
Returns true if the file specified by the file exists.
grpowned?(file)
Returns true if the file specified by the file has gid of effective group.
directory?(file)
Returns true if the file specified by the file is a directory.
file?(file)
Returns true if the file specified by the file is a regular file.
pipe?(file)
Returns true if the file specified by the file is a named pipe (FIFO).
socket?(file)
Returns true if the file specified by the file is a socket.
owned?(file)
Returns true if the file specified by the file is owned by you.
readable?(filename)
Returns true if the file specified by the filename is readable by you.
readable_real?(filename)
Returns true if the file specified by the filename is readable by your real uid/gid.
setuid?(file)
Returns true if the setuid bit of the file specified by the file is set.
setgid?(file)
Returns true if the setgid bit of the file specified by the file is set.
size?(file)
Returns the size of the file specified by the file.
Returns nil
if it does not exist or is empty.
sticky?(file)
Returns true if the sticky bit of the file specified by the file is set.
symlink?(file)
Returns true if the file specified by the file is a symbolic link.
writable?(filename)
Returns true if the file specified by the filename is writable by you.
writable_real?(filename)
Returns true if the file specified by the filename is writable by your real uid/gid.
zero?(file)
Returns true if the file specified by the file exists, and the size of the file is 0.