Ruby file api doc


















On Unix-based systems, permissions are viewed as a set of three octets, for the owner, the group, and the rest of the world. For each of these entities, permissions may be set to read, write, or execute the file:. Higher-order bits may also be used to indicate the type of file plain, directory, pipe, socket, and so on and various other special features. If the permissions are for a directory, the meaning of the execute bit changes; when set the directory can be searched.

On non-Posix operating systems, there may be only the ability to make a file read-only or read-write. In this case, the remaining permission bits will be synthesized to resemble typical values.

The only change that can be made is to make the file read-only, which is reported as Various constants for the methods in File can be found in File::Constants. Inherits from class IO , in particular, methods for creating, reading, and writing files. Includes module FileTest. Same as ::new , but when given a block will yield the file to the block, and close the file upon exiting the block.

Returns whether the file at the given path is executable by the effective user and group of the current process. Returns whether the file at the given path is executable by the real user and group of the current process. Returns the File::Stat object for the last symbolic link in the given path. Returns whether the file at the given path is readable by the effective user and group of the current process.

Returns whether the file at the given path is readable by the real user and group of the current process. Returns the File::Stat object for the file at the given path. Returns whether the file at the given path is writable by the effective user and group of the current process.

Returns whether the file at the given path is writable by the real user and group of the current process. Returns the File::Stat object for the last symbolic link in the path for self. Returns nil if there is no file at the given path, or if that file is empty; otherwise returns the file size bytes. For each given file path, sets the access time and modification time of the last symbolic link in the path. Converts a pathname to an absolute pathname.

Returns the last access time for the named file as a Time object. Actual effects are operating system dependent see the beginning of this section. On Unix systems, see chmod 2 for details. Returns the number of files processed. Changes the owner and group of the named file s to the given numeric owner and group id's.

Only a process with superuser privileges may change the owner of a file. The current owner of a file may change the file's group to any group to which the owner belongs. A nil or -1 owner or group id is ignored. Returns the change time for the named file the time at which directory information about the file was changed, not the file itself.

Deletes the named files, returning the number of names passed as arguments. Raises an exception on any error. Since the underlying implementation relies on the unlink 2 system call, the type of exception raised depends on its error type see linux. Returns true if the named file is a directory, or a symlink that points at a directory, and false otherwise.

Returns true if the named file is executable by the effective user and group id of this process. See eaccess 3. Windows does not support execute permissions separately from read permissions. On Windows, a file is only considered executable if it ends in. Returns true if the named file is executable by the real user and group id of this process.

See access 3. A more complex example which also resolves parent directory is as follows. Returns the extension the portion of file name in path starting from the last period.

C Thread::Backtrace::Location. C UnboundMethod. C UncaughtThrowError. M UnicodeNormalize. C ZeroDivisionError. Complex Kernel. Integer Kernel. Rational Kernel. Home Core 3. Ruby 3. File :: blocking? Dir :: empty? ENV :: empty? GC::Profiler :: enabled?

File :: exist? Dir :: exist? File :: exit Process :: exit Thread :: exit! File :: filter ENV :: filter! ENV :: find Encoding :: fnmatch File :: fnmatch? ENV :: home Dir :: hypot Math :: identical?

ENV :: merge! Thread :: pid Process :: pipe IO :: pipe? File :: slice ENV :: socket? File :: writable? File :: write IO :: yield Fiber :: zero? Fiber alive? Thread all? Array all? Enumerable allbits?

Array any? Enumerable any? Hash anybits? IO autoload Kernel autoload Module autoload? Kernel autoload? ARGF binmode? Kernel blockdev? File::Stat blockdev? FileTest blocking? String captures MatchData casecmp String casecmp Symbol casecmp? String casecmp? Symbol casefold? File::Stat chardev? String chop Kernel chop String chop!

ARGF closed? IO closed? Array compact! File::Stat directory? Time dummy? A File is an abstraction of any file object accessible by the program and is closely associated with class IO. File includes the methods of module FileTest as class methods, allowing you to write for example File. In the description of File methods, permission bits are a platform-specific set of bits that indicate permissions of a file. On Unix-based systems, permissions are viewed as a set of three octets, for the owner, the group, and the rest of the world.

For each of these entities, permissions may be set to read, write, or execute the file:. Higher-order bits may also be used to indicate the type of file plain, directory, pipe, socket, and so on and various other special features. If the permissions are for a directory, the meaning of the execute bit changes; when set the directory can be searched.

On non-Posix operating systems, there may be only the ability to make a file read-only or read-write. In this case, the remaining permission bits will be synthesized to resemble typical values. The only change that can be made is to make the file read-only, which is reported as Various constants for the methods in File can be found in File::Constants.

Converts a pathname to an absolute pathname. Returns the last access time for the named file as a Time object. If the platform doesn't have birthtime, raises NotImplementedError. Actual effects are operating system dependent see the beginning of this section. On Unix systems, see chmod 2 for details. Returns the number of files processed.

Changes the owner and group of the named file s to the given numeric owner and group id's. Only a process with superuser privileges may change the owner of a file. The current owner of a file may change the file's group to any group to which the owner belongs. A nil or -1 owner or group id is ignored. Returns the change time for the named file the time at which directory information about the file was changed, not the file itself.

Deletes the named files, returning the number of names passed as arguments. Raises an exception on any error. Since the underlying implementation relies on the unlink 2 system call, the type of exception raised depends on its error type see linux. Returns true if the named file is a directory, or a symlink that points at a directory, and false otherwise. Returns true if the named file is executable by the effective user and group id of this process.

See eaccess 3. Returns true if the named file is executable by the real user and group id of this process. See access 3. A more complex example which also resolves parent directory is as follows. Returns the extension the portion of file name in path starting from the last period. If path is a dotfile, or starts with a period, then the starting dot is not dealt with the start of the extension.

An empty string will also be returned when the period is the last character in path. Hash include? Module include? ObjectSpace::WeakMap include? Range include? Complex infinite? Float infinite? Integer integer? Object isatty IO isdst Time iterator?

Hash key? ObjectSpace::WeakMap key? Mutex loop Kernel lstat File lstrip String lstrip! Array match Regexp match String match Symbol match? Regexp match?

String match? Enumerable member? Hash member? ObjectSpace::WeakMap member? Range members Struct merge Hash merge! Float negative? Numeric negative? NilClass nil? Object nlink File::Stat nobits? Integer none? Array none? Enumerable nonzero? Array one? File::Stat owned? FileTest owned? File::Stat pipe? Float positive? Numeric positive? File::Stat readable?

Complex real? Array reject! Array reverse! Time scan String scrub String scrub! Array select! File::Stat setgid? FileTest setuid? File::Stat setuid? Array signal ConditionVariable signaled? File::Stat size?

Array slice! File::Stat socket? FileTest sort Array sort Enumerable sort! File::Stat sticky? FileTest stop?



0コメント

  • 1000 / 1000