Module FileTest
In: file.c

FileTest implements file test operations similar to those used in File::Stat. It exists as a standalone module, and its methods are also insinuated into the File class. (Note that this is not done by inclusion: the interpreter cheats).

Methods

Public Instance methods

Returns true if the named file is a block device.

Returns true if the named file is a character device.

Returns true if the named file is a directory, false otherwise.

   File.directory?(".")

Returns true if the named file is executable by the effective user id of this process.

Returns true if the named file is executable by the real user id of this process.

Returns true if the named file exists and is a regular file.

Returns true if the named file exists and the effective group id of the calling process is the owner of the file. Returns false on Windows.

Returns true if the named files are identical.

    open("a", "w") {}
    p File.identical?("a", "a")      #=> true
    p File.identical?("a", "./a")    #=> true
    File.link("a", "b")
    p File.identical?("a", "b")      #=> true
    File.symlink("a", "c")
    p File.identical?("a", "c")      #=> true
    open("d", "w") {}
    p File.identical?("a", "d")      #=> false

Returns true if the named file exists and the effective used id of the calling process is the owner of the file.

Returns true if the named file is a pipe.

Returns true if the named file is readable by the effective user id of this process.

Returns true if the named file is readable by the real user id of this process.

Returns true if the named file has the setgid bit set.

Returns true if the named file has the setuid bit set.

Returns the size of file_name.

Returns nil if file_name doesn‘t exist or has zero size, the size of the file otherwise.

Returns true if the named file is a socket.

Returns true if the named file has the sticky bit set.

Returns true if the named file is a symbolic link.

Returns true if the named file is writable by the effective user id of this process.

Returns true if the named file is writable by the real user id of this process.

Returns true if the named file exists and has a zero size.

[Validate]

ruby-doc.org is a service of James Britt and Neurogami, a Ruby application development company in Phoenix, AZ.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.