Objects of class File::Stat encapsulate common status information for File objects. The information is recorded at the moment the File::Stat object is created; changes made to the file after that point will not be reflected. File::Stat objects are returned by IO#stat, File::stat, File#lstat, and File::lstat. Many of these methods return platform-specific values, and not all values are meaningful on all systems. See also Kernel#test.
| Public Methods | |
|---|---|
| <=> | Compares File::Stat objects by comparing their respective modification times. |
| atime | Returns the last access time for this file as an object of class Time. |
| blksize | Returns the native file system’s block size. Will return nil on platforms that don’t support this information. |
| blockdev? | Returns true if the file is a block device, false if it isn’t or if the operating system doesn’t support this feature. |
| blocks | Returns the number of native file system blocks allocated for this file, or nil if the operating system doesn’t support this feature. |
| chardev? | Returns true if the file is a character device, false if it isn’t or if the operating system doesn’t support this feature. |
| ctime | Returns the change time for stat (that is, the time directory information about the file was changed, not the file itself). |
| dev | Returns an integer representing the device on which stat resides. |
| dev_ |
Returns the major part of File_Stat#dev or nil. |
| dev_ |
Returns the minor part of File_Stat#dev or nil. |
| directory? | Returns true if stat is a directory, false otherwise. |
| executable? | Returns true if stat is executable or if the operating system doesn’t distinguish executable files from nonexecutable files. The tests are made using the effective owner of the process. |
| executable_ |
Same as executable?, but tests using the real owner of the process. |
| file? | Returns true if stat is a regular file (not a device file, pipe, socket, etc.). |
| ftype | Identifies the type of stat. The return string is one of: ``file’’, ``directory’’, ``characterSpecial’’, ``blockSpecial’’, ``fifo’’, ``link’’, ``socket’’, or ``unknown’’. |
| gid | Returns the numeric group id of the owner of stat. |
| grpowned? | Returns true if the effective group id of the process is the same as the group id of stat. On Windows NT, returns false. |
| ino | Returns the inode number for stat. |
| inspect | Produce a nicely formatted description of stat. |
| mode | Returns an integer representing the permission bits of stat. The meaning of the bits is platform dependent; on Unix systems, see stat(2). |
| mtime | Returns the modification time of stat. |
| new | File::Stat.new(file_name) => stat |
| nlink | Returns the number of hard links to stat. |
| owned? | Returns true if the effective user id of the process is the same as the owner of stat. |
| pipe? | Returns true if the operating system supports pipes and stat is a pipe; false otherwise. |
| rdev | Returns an integer representing the device type on which stat resides. Returns nil if the operating system doesn’t support this feature. |
| rdev_ |
Returns the major part of File_Stat#rdev or nil. |
| rdev_ |
Returns the minor part of File_Stat#rdev or nil. |
| readable? | Returns true if stat is readable by the effective user id of this process. |
| readable_ |
Returns true if stat is readable by the real user id of this process. |
| setgid? | Returns true if stat has the set-group-id permission bit set, false if it doesn’t or if the operating system doesn’t support this feature. |
| setuid? | Returns true if stat has the set-user-id permission bit set, false if it doesn’t or if the operating system doesn’t support this feature. |
| size | Returns the size of stat in bytes. |
| size? | Returns the size of stat in bytes. |
| socket? | Returns true if stat is a socket, false if it isn’t or if the operating system doesn’t support this feature. |
| sticky? | Returns true if stat has its sticky bit set, false if it doesn’t or if the operating system doesn’t support this feature. |
| symlink? | Returns true if stat is a symbolic link, false if it isn’t or if the operating system doesn’t support this feature. As File::stat automatically follows symbolic links, symlink? will always be false for an object returned by File::stat. |
| uid | Returns the numeric user id of the owner of stat. |
| writable? | Returns true if stat is writable by the effective user id of this process. |
| writable_ |
Returns true if stat is writable by the real user id of this process. |
| zero? | Returns true if stat is a zero-length file; false otherwise. |
<code/>and<pre/>for code samples.