📁 File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-21 20:11:41
📂
/ (Root)
/
opt
/
alt
/
ruby31
/
share
/
ri
/
system
/
File
📍 /opt/alt/ruby31/share/ri/system/File
🔄 Refresh
✏️
Editing: cdesc-File.ri
Read Only
U:RDoc::NormalClass[iI" File:ET@I"IO;To:RDoc::Markup::Document:@parts[o;;[.o:RDoc::Markup::Paragraph;[ I"CA File is an abstraction of any file object accessible by the ;TI"Eprogram and is closely associated with class IO. File includes ;TI"Fthe methods of module FileTest as class methods, allowing you to ;TI"9write (for example) <code>File.exist?("foo")</code>.;To:RDoc::Markup::BlankLine o; ;[I")In the description of File methods, ;TI"6<em>permission bits</em> are a platform-specific ;TI"Dset of bits that indicate permissions of a file. On Unix-based ;TI"Gsystems, permissions are viewed as a set of three octets, for the ;TI"Downer, the group, and the rest of the world. For each of these ;TI"Eentities, permissions may be set to read, write, or execute the ;TI" file:;T@o; ;[I"DThe permission bits <code>0644</code> (in octal) would thus be ;TI"Finterpreted as read/write for owner, and read-only for group and ;TI"Gother. Higher-order bits may also be used to indicate the type of ;TI"Hfile (plain, directory, pipe, socket, and so on) and various other ;TI"Cspecial features. If the permissions are for a directory, the ;TI"Gmeaning of the execute bit changes; when set the directory can be ;TI"searched.;T@o; ;[I"FOn non-Posix operating systems, there may be only the ability to ;TI"Fmake a file read-only or read-write. In this case, the remaining ;TI"Ipermission bits will be synthesized to resemble typical values. For ;TI"=instance, on Windows NT the default permission bits are ;TI"H<code>0644</code>, which means read/write for owner, read-only for ;TI"Fall others. The only change that can be made is to make the file ;TI"7read-only, which is reported as <code>0444</code>.;T@o; ;[I"OVarious constants for the methods in File can be found in File::Constants.;T@S:RDoc::Markup::Heading: leveli: textI"What's Here;T@o; ;[I"+First, what's elsewhere. \Class \File:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"EInherits from {class IO}[IO.html#class-IO-label-What-27s+Here], ;TI"Din particular, methods for creating, reading, and writing files;To;;0;[o; ;[I"TIncludes {module FileTest}[FileTest.html#module-FileTest-label-What-27s+Here]. ;TI"1which provides dozens of additional methods.;T@o; ;[I"<Here, class \File provides methods that are useful for:;T@o;;;;[ o;;0;[o; ;[I"+{Creating}[#class-File-label-Creating];To;;0;[o; ;[I"+{Querying}[#class-File-label-Querying];To;;0;[o; ;[I"+{Settings}[#class-File-label-Settings];To;;0;[o; ;[I"%{Other}[#class-File-label-Other];T@S;;i; I" Creating;T@o;;;;[ o;;0;[o;;: NOTE;[o;;[I" ::new;T;[o; ;[I"8Opens the file at the given path; returns the file.;To;;0;[o;;;;[o;;[I"::open;T;[o; ;[I"MSame as ::new, but when given a block will yield the file to the block, ;TI"/and close the file upon exiting the block.;To;;0;[o;;;;[o;;[I"::link;T;[o; ;[I"?Creates a new name for an existing file using a hard link.;To;;0;[o;;;;[o;;[I" ::mkfifo;T;[o; ;[I"5Returns the FIFO file created at the given path.;To;;0;[o;;;;[o;;[I"::symlink;T;[o; ;[I"5Creates a symbolic link for the given file path.;T@S;;i; I" Querying;T@o; ;[I"_Paths_;T@o;;;;[o;;0;[o;;;;[o;;[I"::absolute_path;T;[o; ;[I"7Returns the absolute file path for the given path.;To;;0;[o;;;;[o;;[I"::absolute_path?;T;[o; ;[I">Returns whether the given path is the absolute file path.;To;;0;[o;;;;[o;;[I"::basename;T;[o; ;[I"7Returns the last component of the given file path.;To;;0;[o;;;;[o;;[I"::dirname;T;[o; ;[I"?Returns all but the last component of the given file path.;To;;0;[o;;;;[o;;[I"::expand_path;T;[o; ;[I"8Returns the absolute file path for the given path, ;TI"/expanding <tt>~</tt> for a home directory.;To;;0;[o;;;;[o;;[I"::extname;T;[o; ;[I"8Returns the file extension for the given file path.;To;;0;[o;;;;[o;;[I"&::fnmatch? (aliased as ::fnmatch);T;[o; ;[I")Returns whether the given file path ;TI"matches the given pattern.;To;;0;[o;;;;[o;;[I"::join;T;[o; ;[I"5Joins path components into a single path string.;To;;0;[o;;;;[o;;[I"::path;T;[o; ;[I"9Returns the string representation of the given path.;To;;0;[o;;;;[o;;[I"::readlink;T;[o; ;[I"=Returns the path to the file at the given symbolic link.;To;;0;[o;;;;[o;;[I"::realdirpath;T;[o; ;[I"4Returns the real path for the given file path, ;TI"-where the last component need not exist.;To;;0;[o;;;;[o;;[I"::realpath;T;[o; ;[I"4Returns the real path for the given file path, ;TI"%where all components must exist.;To;;0;[o;;;;[o;;[I"::split;T;[o; ;[I"FReturns an array of two strings: the directory name and basename ;TI"#of the file at the given path.;To;;0;[o;;;;[o;;[I" #path (aliased as #to_path);T;[o; ;[I"9Returns the string representation of the given path.;T@o; ;[I"_Times_;T@o;;;;[ o;;0;[o;;;;[o;;[I"::atime;T;[o; ;[I"BReturns a \Time for the most recent access to the given file.;To;;0;[o;;;;[o;;[I"::birthtime;T;[o; ;[I"9Returns a \Time for the creation of the given file.;To;;0;[o;;;;[o;;[I"::ctime;T;[o; ;[I"@Returns a \Time for the metadata change of the given file.;To;;0;[o;;;;[o;;[I"::mtime;T;[o; ;[I">Returns a \Time for the most recent data modification to ;TI"#the content of the given file.;To;;0;[o;;;;[o;;[I"#atime;T;[o; ;[I":Returns a \Time for the most recent access to +self+.;To;;0;[o;;;;[o;;[I"#birthtime;T;[o; ;[I".Returns a \Time the creation for +self+.;To;;0;[o;;;;[o;;[I"#ctime;T;[o; ;[I"7Returns a \Time for the metadata change of +self+.;To;;0;[o;;;;[o;;[I"#mtime;T;[o; ;[I";Returns a \Time for the most recent data modification ;TI"to the content of +self+.;T@o; ;[I"_Types_;T@o;;;;[ o;;0;[o;;;;[o;;[I"::blockdev?;T;[o; ;[I"BReturns whether the file at the given path is a block device.;To;;0;[o;;;;[o;;[I"::chardev?;T;[o; ;[I"FReturns whether the file at the given path is a character device.;To;;0;[o;;;;[o;;[I"::directory?;T;[o; ;[I">Returns whether the file at the given path is a diretory.;To;;0;[o;;;;[o;;[I"::executable?;T;[o; ;[I">Returns whether the file at the given path is executable ;TI"<by the effective user and group of the current process.;To;;0;[o;;;;[o;;[I"::executable_real?;T;[o; ;[I">Returns whether the file at the given path is executable ;TI"7by the real user and group of the current process.;To;;0;[o;;;;[o;;[I" ::exist?;T;[o; ;[I"7Returns whether the file at the given path exists.;To;;0;[o;;;;[o;;[I"::file?;T;[o; ;[I"BReturns whether the file at the given path is a regular file.;To;;0;[o;;;;[o;;[I"::ftype;T;[o; ;[I"DReturns a string giving the type of the file at the given path.;To;;0;[o;;;;[o;;[I"::grpowned?;T;[o; ;[I"@Returns whether the effective group of the current process ;TI"%owns the file at the given path.;To;;0;[o;;;;[o;;[I"::identical?;T;[o; ;[I"@Returns whether the files at two given paths are identical.;To;;0;[o;;;;[o;;[I"::lstat;T;[o; ;[I">Returns the File::Stat object for the last symbolic link ;TI"in the given path.;To;;0;[o;;;;[o;;[I" ::owned?;T;[o; ;[I"?Returns whether the effective user of the current process ;TI"%owns the file at the given path.;To;;0;[o;;;;[o;;[I"::pipe?;T;[o; ;[I":Returns whether the file at the given path is a pipe.;To;;0;[o;;;;[o;;[I"::readable?;T;[o; ;[I"<Returns whether the file at the given path is readable ;TI"<by the effective user and group of the current process.;To;;0;[o;;;;[o;;[I"::readable_real?;T;[o; ;[I"<Returns whether the file at the given path is readable ;TI"7by the real user and group of the current process.;To;;0;[o;;;;[o;;[I"::setgid?;T;[o; ;[I"JReturns whether the setgid bit is set for the file at the given path.;To;;0;[o;;;;[o;;[I"::setuid?;T;[o; ;[I"JReturns whether the setuid bit is set for the file at the given path.;To;;0;[o;;;;[o;;[I"::socket?;T;[o; ;[I"<Returns whether the file at the given path is a socket.;To;;0;[o;;;;[o;;[I"::stat;T;[o; ;[I"BReturns the File::Stat object for the file at the given path.;To;;0;[o;;;;[o;;[I"::sticky?;T;[o; ;[I"GReturns whether the file at the given path has its sticky bit set.;To;;0;[o;;;;[o;;[I"::symlink?;T;[o; ;[I"CReturns whether the file at the given path is a symbolic link.;To;;0;[o;;;;[o;;[I"::umask;T;[o; ;[I"5Returns the umask value for the current process.;To;;0;[o;;;;[o;;[I"::world_readable?;T;[o; ;[I"<Returns whether the file at the given path is readable ;TI"by others.;To;;0;[o;;;;[o;;[I"::world_writable?;T;[o; ;[I"<Returns whether the file at the given path is writable ;TI"by others.;To;;0;[o;;;;[o;;[I"::writable?;T;[o; ;[I"<Returns whether the file at the given path is writable ;TI"<by the effective user and group of the current process.;To;;0;[o;;;;[o;;[I"::writable_real?;T;[o; ;[I"<Returns whether the file at the given path is writable ;TI"7by the real user and group of the current process.;To;;0;[o;;;;[o;;[I"#lstat;T;[o; ;[I">Returns the File::Stat object for the last symbolic link ;TI"in the path for +self+.;T@o; ;[I"_Contents_;T@o;;;;[ o;;0;[o;;;;[o;;[I""::empty? (aliased as ::zero?);T;[o; ;[I"0Returns whether the file at the given path ;TI"exists and is empty.;To;;0;[o;;;;[o;;[I"::size;T;[o; ;[I"<Returns the size (bytes) of the file at the given path.;To;;0;[o;;;;[o;;[I"::size?;T;[o; ;[I":Returns +nil+ if there is no file at the given path, ;TI"Gor if that file is empty; otherwise returns the file size (bytes).;To;;0;[o;;;;[o;;[I" #size;T;[o; ;[I"(Returns the size (bytes) of +self+.;T@S;;i; I" Settings;T@o;;;;[ o;;0;[o;;;;[o;;[I"::chmod;T;[o; ;[I"7Changes permissions of the file at the given path.;To;;0;[o;;;;[o;;[I"::chown;T;[o; ;[I"4Change ownership of the file at the given path.;To;;0;[o;;;;[o;;[I" ::lchmod;T;[o; ;[I"EChanges permissions of the last symbolic link in the given path.;To;;0;[o;;;;[o;;[I" ::lchown;T;[o; ;[I"=Change ownership of the last symbolic in the given path.;To;;0;[o;;;;[o;;[I" ::lutime;T;[o; ;[I"JFor each given file path, sets the access time and modification time ;TI"+of the last symbolic link in the path.;To;;0;[o;;;;[o;;[I" ::rename;T;[o; ;[I"<Moves the file at one given path to another given path.;To;;0;[o;;;;[o;;[I"::utime;T;[o; ;[I"=Sets the access time and modification time of each file ;TI"at the given paths.;To;;0;[o;;;;[o;;[I"#flock;T;[o; ;[I"Locks or unlocks +self+.;T@S;;i; I" Other;T@o;;;;[o;;0;[o;;;;[o;;[I"::truncate;T;[o; ;[I"ATruncates the file at the given file path to the given size.;To;;0;[o;;;;[o;;[I"#::unlink (aliased as ::delete);T;[o; ;[I"/Deletes the file for each given file path.;To;;0;[o;;;;[o;;[I"#truncate;T;[o; ;[I"(Truncates +self+ to the given size.;T: @fileI"file.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ U:RDoc::Constant[i I"Separator;TI"File::Separator;T:public0o;;[o; ;[I"&separates directory parts in path;T@;@�;0@�@cRDoc::NormalClass0U;[i I"SEPARATOR;TI"File::SEPARATOR;T;0o;;[o; ;[I"&separates directory parts in path;T@;@�;0@�@@�0U;[i I"ALT_SEPARATOR;TI"File::ALT_SEPARATOR;T;0o;;[o; ;[I",platform specific alternative separator;T@;@�;0@�@@�0U;[i I"PATH_SEPARATOR;TI"File::PATH_SEPARATOR;T;0o;;[o; ;[I"path list separator;T@;@�;0@�@@�0[ [[I" class;T[[;[ [:protected[ [:private[D[I"absolute_path;TI"file.c;T[I"absolute_path?;T@�[I" atime;T@�[I" basename;T@�[I"birthtime;T@�[I"blockdev?;T@�[I" chardev?;T@�[I" chmod;T@�[I" chown;T@�[I" ctime;T@�[I"delete;T@�[I"directory?;T@�[I"dirname;T@�[I"empty?;T@�[I"executable?;T@�[I"executable_real?;T@�[I"exist?;T@�[I"expand_path;T@�[I"extname;T@�[I" file?;T@�[I"fnmatch;TI"dir.rb;T[I" fnmatch?;T@�[I" ftype;T@�[I"grpowned?;T@�[I"identical?;T@�[I" join;T@�[I"lchmod;T@�[I"lchown;T@�[I" link;T@�[I" lstat;T@�[I"lutime;T@�[I"mkfifo;T@�[I" mtime;T@�[I"new;TI" io.c;T[I" open;T@[I"owned?;T@�[I" path;T@�[I" pipe?;T@�[I"readable?;T@�[I"readable_real?;T@�[I" readlink;T@�[I"realdirpath;T@�[I" realpath;T@�[I"rename;T@�[I"setgid?;T@�[I"setuid?;T@�[I" size;T@�[I" size?;T@�[I"socket?;T@�[I" split;T@�[I" stat;T@�[I"sticky?;T@�[I"symlink;T@�[I" symlink?;T@�[I" truncate;T@�[I" umask;T@�[I"unlink;T@�[I" utime;T@�[I"world_readable?;T@�[I"world_writable?;T@�[I"writable?;T@�[I"writable_real?;T@�[I" zero?;T@�[I" instance;T[[;[ [;[ [;[[I" atime;T@�[I"birthtime;T@�[I" chmod;T@�[I" chown;T@�[I" ctime;T@�[I" flock;T@�[I" lstat;T@�[I" mtime;T@�[I" path;T@�[I" size;T@�[I"to_path;T@�[I" truncate;T@�[ [U:RDoc::Context::Section[i 0o;;[ ;0;0["I" dir.c;TI"!ext/pathname/lib/pathname.rb;TI"file.c;TI" io.c;TI"lib/bundler.rb;TI"lib/cgi/session.rb;TI"lib/cgi/session/pstore.rb;TI"lib/fileutils.rb;TI"lib/irb.rb;TI"lib/irb/ext/loader.rb;TI"lib/irb/ext/tracer.rb;TI"lib/irb/init.rb;TI"lib/logger.rb;TI"lib/logger/log_device.rb;TI"lib/mkmf.rb;TI"lib/open-uri.rb;TI"lib/optparse.rb;TI"lib/pp.rb;TI"lib/pstore.rb;TI"lib/rubygems.rb;TI"(lib/rubygems/basic_specification.rb;TI"1lib/rubygems/commands/environment_command.rb;TI"+lib/rubygems/commands/setup_command.rb;TI" lib/rubygems/config_file.rb;TI"lib/rubygems/defaults.rb;TI"lib/rubygems/installer.rb;TI"lib/rubygems/package.rb;TI"!lib/rubygems/path_support.rb;TI"lib/tempfile.rb;TI"lib/pp.rb;TcRDoc::TopLevel
💾 Save Changes
❌ Cancel