Name
FileTest — File testing module
Synopsis
The
FileTest
module contains methods for testing
files. The methods in this module are also provided as class methods
of the File
class.
Module Functions
blockdev?(
path
)
Returns
true
ifpath
is a block device.chardev?(
path
)
Returns
true
ifpath
is a character device.directory?(
path
)
Returns
true
ifpath
is a directory.executable?(
path
)
Returns
true
ifpath
is executable.executable_real?(
path
)
Returns
true
ifpath
is executable with real user permissions.exist?(
path
)
Returns
true
ifpath
exists.file?(
path
)
Returns
true
ifpath
is a regular file.grpowned?(
path
)
Returns
true
ifpath
is owned by the user’s group.owned?(
path
)
Returns
true
ifpath
is owned by the effective user.pipe?(
path
)
Returns
true
ifpath
is a pipe.readable?(
path
)
Returns
true
ifpath
is readable.readable_real?(
path
)
Returns
true
ifpath
is readable with real user permissions.setgid?(
path
)
Returns
true
ifpath
’s set-group-id permission bit is set.setuid?(
path
)
Returns
true
ifpath
’s set-user-id permission bit is set.size(
path
)
Returns the file size of
path
.size?(
path
)
Returns the file size of
path
ornil
if it’s0
.socket?(
path
)
Returns
true
ifpath
is a socket.sticky?(
path
)
Returns
true
ifpath
’s sticky bit is set.symlink?(
path
)
Returns
true
ifpath
is a symbolic link.writable?(
path
)
Returns
true
ifpath
is writable.writable_real?(
path
)
Returns
true
ifpath
is writable with real user permissions.zero?(
path
)
Returns
true
if the file size ofpath
is 0.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.