D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
File
/
Constants
/
Filename :
cdesc-Constants.ri
back
Copy
U:RDoc::NormalModule[iI"Constants:ETI"File::Constants;T0o:RDoc::Markup::Document:@parts[o;;[�o:RDoc::Markup::Paragraph;[I">\Module +File::Constants+ defines file-related constants.;To:RDoc::Markup::BlankLine o; ;[I".There are two families of constants here:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"QThose having to do with {file access}[rdoc-ref:File::Constants@File+Access].;To;;0;[o; ;[I"Those having to do with {filename globbing}[rdoc-ref:File::Constants@Filename+Globbing+Constants+-28File-3A-3AFNM_-2A-29].;T@o; ;[I"D\File constants defined for the local process may be retrieved ;TI"+with method File::Constants.constants:;T@o:RDoc::Markup::Verbatim;[I"'File::Constants.constants.take(5) ;TI"5# => [:RDONLY, :WRONLY, :RDWR, :APPEND, :CREAT] ;T:@format0S:RDoc::Markup::Heading: leveli: textI"\File Access;T@o; ;[I"O\File-access constants may be used with optional argument +mode+ in calls ;TI"to the following methods:;T@o;;; ;[o;;0;[o; ;[I"File.new.;To;;0;[o; ;[I"File.open.;To;;0;[o; ;[I"IO.for_fd.;To;;0;[o; ;[I"IO.new.;To;;0;[o; ;[I" IO.open.;To;;0;[o; ;[I"IO.popen.;To;;0;[o; ;[I"IO.reopen.;To;;0;[o; ;[I"IO.sysopen.;To;;0;[o; ;[I"StringIO.new.;To;;0;[o; ;[I"StringIO.open.;To;;0;[o; ;[I"StringIO#reopen.;T@S;;i;I"Read/Write Access;T@o; ;[I"$Read-write access for a stream ;TI"0may be specified by a file-access constant.;T@o; ;[I"SThe constant may be specified as part of a bitwise OR of other such constants.;T@o; ;[I"GAny combination of the constants in this section may be specified.;T@S;;i ;I"File::RDONLY;T@o; ;[I"NFlag File::RDONLY specifies the stream should be opened for reading only:;T@o;;[I"filepath = '/tmp/t.tmp' ;TI"*f = File.new(filepath, File::RDONLY) ;TI"?f.write('Foo') # Raises IOError (not opened for writing). ;T;0S;;i ;I"File::WRONLY;T@o; ;[I"SFlag File::WRONLY specifies that the stream should be opened for writing only:;T@o;;[I"*f = File.new(filepath, File::WRONLY) ;TI"7f.read # Raises IOError (not opened for reading). ;T;0S;;i ;I"File::RDWR;T@o; ;[I"@Flag File::RDWR specifies that the stream should be opened ;TI""for both reading and writing:;T@o;;[ I"(f = File.new(filepath, File::RDWR) ;TI"f.write('Foo') # => 3 ;TI"f.rewind # => 0 ;TI"f.read # => "Foo" ;T;0S;;i;I"\File Positioning;T@S;;i ;I"File::APPEND;T@o; ;[I"BFlag File::APPEND specifies that the stream should be opened ;TI"in append mode.;T@o; ;[I"HBefore each write operation, the position is set to end-of-stream. ;TI"HThe modification of the position and the following write operation ;TI"+are performed as a single atomic step.;T@S;;i ;I"File::TRUNC;T@o; ;[ I"DFlag File::TRUNC specifies that the stream should be truncated ;TI"at its beginning. ;TI"@If the file exists and is successfully opened for writing, ;TI"-it is to be truncated to position zero; ;TI"%its ctime and mtime are updated.;T@o; ;[I"EThere is no effect on a FIFO special file or a terminal device. ;TI"?The effect on other file types is implementation-defined. ;TI"DThe result of using File::TRUNC with File::RDONLY is undefined.;T@S;;i;I"Creating and Preserving;T@S;;i ;I"File::CREAT;T@o; ;[I"BFlag File::CREAT specifies that the stream should be created ;TI""if it does not already exist.;T@o; ;[I"If the file exists:;T@o;;[I";- Raise an exception if File::EXCL is also specified. ;TI"- Otherwise, do nothing. ;T;0o; ;[I"5If the file does not exist, then it is created. ;TI"VUpon successful completion, the atime, ctime, and mtime of the file are updated, ;TI"Aand the ctime and mtime of the parent directory are updated.;T@S;;i ;I"File::EXCL;T@o; ;[I"IFlag File::EXCL specifies that the stream should not already exist; ;TI"<If flags File::CREAT and File::EXCL are both specified ;TI";and the stream already exists, an exception is raised.;T@o; ;[I"MThe check for the existence and creation of the file is performed as an ;TI"atomic operation.;T@o; ;[I"ZIf both File::EXCL and File::CREAT are specified and the path names a symbolic link, ;TI"Lan exception is raised regardless of the contents of the symbolic link.;T@o; ;[I"BIf File::EXCL is specified and File::CREAT is not specified, ;TI"the result is undefined.;T@S;;i;I"POSIX \File \Constants;T@o; ;[I"MSome file-access constants are defined only on POSIX-compliant systems; ;TI"those are:;T@o;;; ;[ o;;0;[o; ;[I"File::SYNC.;To;;0;[o; ;[I"File::DSYNC.;To;;0;[o; ;[I"File::RSYNC.;To;;0;[o; ;[I"File::DIRECT.;To;;0;[o; ;[I"File::NOATIME.;To;;0;[o; ;[I"File::NOCTTY.;To;;0;[o; ;[I"File::NOFOLLOW.;To;;0;[o; ;[I"File::TMPFILE.;T@S;;i ;I"-File::SYNC, File::RSYNC, and File::DSYNC;T@o; ;[I"2Flag File::SYNC, File::RSYNC, or File::DSYNC ;TI"Qspecifies synchronization of I/O operations with the underlying file system.;T@o; ;[I"<These flags are valid only for POSIX-compliant systems.;T@o;;; ;[o;;0;[o; ;[I"MFile::SYNC specifies that all write operations (both data and metadata) ;TI"Eare immediately to be flushed to the underlying storage device. ;TI"@This means that the data is written to the storage device, ;TI"Hand the file's metadata (e.g., file size, timestamps, permissions) ;TI"are also synchronized. ;TI"FThis guarantees that data is safely stored on the storage medium ;TI"6before returning control to the calling program. ;TI"<This flag can have a significant impact on performance ;TI"?since it requires synchronous writes, which can be slower ;TI"%compared to asynchronous writes.;T@o;;0;[o; ;[ I"PFile::RSYNC specifies that any read operations on the file will not return ;TI",until all outstanding write operations ;TI"L(those that have been issued but not completed) are also synchronized. ;TI"DThis is useful when you want to read the most up-to-date data, ;TI"8which may still be in the process of being written.;T@o;;0;[o; ;[ I"<File::DSYNC specifies that all _data_ write operations ;TI"Eare immediately to be flushed to the underlying storage device; ;TI"Bthis differs from File::SYNC, which requires that _metadata_ ;TI"also be synchronized.;T@o; ;[I"=Note that the behavior of these flags may vary slightly ;TI"Bdepending on the operating system and filesystem being used. ;TI"GAdditionally, using these flags can have an impact on performance ;TI":due to the synchronous nature of the I/O operations, ;TI")so they should be used judiciously, ;TI"5especially in performance-critical applications.;T@S;;i ;I"File::NOCTTY;T@o; ;[I"JFlag File::NOCTTY specifies that if the stream is a terminal device, ;TI"Jthat device does not become the controlling terminal for the process.;T@o; ;[I".Defined only for POSIX-compliant systems.;T@S;;i ;I"File::DIRECT;T@o; ;[I"UFlag File::DIRECT requests that cache effects of the I/O to and from the stream ;TI"be minimized.;T@o; ;[I".Defined only for POSIX-compliant systems.;T@S;;i ;I"File::NOATIME;T@o; ;[I"AFlag File::NOATIME specifies that act of opening the stream ;TI"/should not modify its access time (atime).;T@o; ;[I".Defined only for POSIX-compliant systems.;T@S;;i ;I"File::NOFOLLOW;T@o; ;[I"DFlag File::NOFOLLOW specifies that if path is a symbolic link, ;TI"it should not be followed.;T@o; ;[I".Defined only for POSIX-compliant systems.;T@S;;i ;I"File::TMPFILE;T@o; ;[I"9Flag File::TMPFILE specifies that the opened stream ;TI"$should be a new temporary file.;T@o; ;[I".Defined only for POSIX-compliant systems.;T@S;;i;I"!Other File-Access \Constants;T@S;;i ;I"File::NONBLOCK;T@o; ;[I"<When possible, the file is opened in nonblocking mode. ;TI"ENeither the open operation nor any subsequent I/O operations on ;TI"5the file will cause the calling process to wait.;T@S;;i ;I"File::BINARY;T@o; ;[I"RFlag File::BINARY specifies that the stream is to be accessed in binary mode.;T@S;;i ;I"File::SHARE_DELETE;T@o; ;[I"HFlag File::SHARE_DELETE enables other processes to open the stream ;TI"with delete access.;T@o; ;[I"Windows only.;T@o; ;[I"SIf the stream is opened for (local) delete access without File::SHARE_DELETE, ;TI"Aand another process attempts to open it with delete access, ;TI"Ethe attempt fails and the stream is not opened for that process.;T@S;;i;I"Locking;T@o; ;[I"3Four file constants relate to stream locking; ;TI"see File#flock:;T@S;;i ;I"File::LOCK_EX;T@o; ;[I"5Flag File::LOCK_EX specifies an exclusive lock; ;TI"3only one process a a time may lock the stream.;T@S;;i ;I"File::LOCK_NB;T@o; ;[I"GFlag File::LOCK_NB specifies non-blocking locking for the stream; ;TI"9may be combined with File::LOCK_EX or File::LOCK_SH.;T@S;;i ;I"File::LOCK_SH;T@o; ;[I"CFlag File::LOCK_SH specifies that multiple processes may lock ;TI"!the stream at the same time.;T@S;;i ;I"File::LOCK_UN;T@o; ;[I"FFlag File::LOCK_UN specifies that the stream is not to be locked.;T@S;;i;I"/Filename Globbing \Constants (File::FNM_*);T@o; ;[I"LFilename-globbing constants may be used with optional argument +flags+ ;TI"'in calls to the following methods:;T@o;;; ;[ o;;0;[o; ;[I"Dir.glob.;To;;0;[o; ;[I"File.fnmatch.;To;;0;[o; ;[I"Pathname#fnmatch.;To;;0;[o; ;[I"Pathname.glob.;To;;0;[o; ;[I"Pathname#glob.;T@o; ;[I"The constants are:;T@S;;i ;I"File::FNM_CASEFOLD;T@o; ;[I"=Flag File::FNM_CASEFOLD makes patterns case insensitive ;TI")for File.fnmatch (but not Dir.glob).;T@S;;i ;I"File::FNM_DOTMATCH;T@o; ;[I"<Flag File::FNM_DOTMATCH makes the <tt>'*'</tt> pattern ;TI"1match a filename starting with <tt>'.'</tt>.;T@S;;i ;I"File::FNM_EXTGLOB;T@o; ;[ I"BFlag File::FNM_EXTGLOB enables pattern <tt>'{_a_,_b_}'</tt>, ;TI"4which matches pattern '_a_' and pattern '_b_'; ;TI"behaves like ;TI"-a {regexp union}[rdoc-ref:Regexp.union] ;TI"$(e.g., <tt>'(?:_a_|_b_)'</tt>):;T@o;;[ I"pattern = '{LEGAL,BSDL}' ;TI"3Dir.glob(pattern) # => ["LEGAL", "BSDL"] ;TI"GPathname.glob(pattern) # => [#<Pathname:LEGAL>, #<Pathname:BSDL>] ;TI"Gpathname.glob(pattern) # => [#<Pathname:LEGAL>, #<Pathname:BSDL>] ;T;0S;;i ;I"File::FNM_NOESCAPE;T@o; ;[I"<Flag File::FNM_NOESCAPE disables <tt>'\'</tt> escaping.;T@S;;i ;I"File::FNM_PATHNAME;T@o; ;[I"SFlag File::FNM_PATHNAME specifies that patterns <tt>'*'</tt> and <tt>'?'</tt> ;TI"*do not match the directory separator ;TI"-(the value of constant File::SEPARATOR).;T@S;;i ;I"File::FNM_SHORTNAME;T@o; ;[I"QFlag File::FNM_SHORTNAME allows patterns to match short names if they exist.;T@o; ;[I"Windows only.;T@S;;i ;I"File::FNM_SYSCASE;T@o; ;[I"<Flag File::FNM_SYSCASE specifies that case sensitivity ;TI"8is the same as in the underlying operating system; ;TI"2effective for File.fnmatch, but not Dir.glob.;T@S;;i;I"Other \Constants;T@S;;i ;I"File::NULL;T@o; ;[I"BFlag File::NULL contains the string value of the null device:;T@o;;; ;[o;;0;[o; ;[I"-On a Unix-like OS, <tt>'/dev/null'</tt>.;To;;0;[o; ;[I" On Windows, <tt>'NUL'</tt>.;T: @fileI"file.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [#U:RDoc::Constant[i I"FNM_NOESCAPE;TI""File::Constants::FNM_NOESCAPE;T:public0o;;[o; ;[I"J{File::FNM_NOESCAPE}[rdoc-ref:File::Constants@File-3A-3AFNM_NOESCAPE];T@;I" dir.c;T;0@@cRDoc::NormalModule0U;[i I"FNM_PATHNAME;TI""File::Constants::FNM_PATHNAME;T;0o;;[o; ;[I"J{File::FNM_PATHNAME}[rdoc-ref:File::Constants@File-3A-3AFNM_PATHNAME];T@;@;0@@@0U;[i I"FNM_DOTMATCH;TI""File::Constants::FNM_DOTMATCH;T;0o;;[o; ;[I"J{File::FNM_DOTMATCH}[rdoc-ref:File::Constants@File-3A-3AFNM_DOTMATCH];T@;@;0@@@0U;[i I"FNM_CASEFOLD;TI""File::Constants::FNM_CASEFOLD;T;0o;;[o; ;[I"J{File::FNM_CASEFOLD}[rdoc-ref:File::Constants@File-3A-3AFNM_CASEFOLD];T@;@;0@@@0U;[i I"FNM_EXTGLOB;TI"!File::Constants::FNM_EXTGLOB;T;0o;;[o; ;[I"H{File::FNM_EXTGLOB}[rdoc-ref:File::Constants@File-3A-3AFNM_EXTGLOB];T@;@;0@@@0U;[i I"FNM_SYSCASE;TI"!File::Constants::FNM_SYSCASE;T;0o;;[o; ;[I"H{File::FNM_SYSCASE}[rdoc-ref:File::Constants@File-3A-3AFNM_SYSCASE];T@;@;0@@@0U;[i I"FNM_SHORTNAME;TI"#File::Constants::FNM_SHORTNAME;T;0o;;[o; ;[I"L{File::FNM_SHORTNAME}[rdoc-ref:File::Constants@File-3A-3AFNM_SHORTNAME];T@;@;0@@@0U;[i I"RDONLY;TI"File::Constants::RDONLY;T;0o;;[o; ;[I">{File::RDONLY}[rdoc-ref:File::Constants@File-3A-3ARDONLY];T@;@;0@@@0U;[i I"WRONLY;TI"File::Constants::WRONLY;T;0o;;[o; ;[I">{File::WRONLY}[rdoc-ref:File::Constants@File-3A-3AWRONLY];T@;@;0@@@0U;[i I" RDWR;TI"File::Constants::RDWR;T;0o;;[o; ;[I":{File::RDWR}[rdoc-ref:File::Constants@File-3A-3ARDWR];T@;@;0@@@0U;[i I"APPEND;TI"File::Constants::APPEND;T;0o;;[o; ;[I">{File::APPEND}[rdoc-ref:File::Constants@File-3A-3AAPPEND];T@;@;0@@@0U;[i I" CREAT;TI"File::Constants::CREAT;T;0o;;[o; ;[I"<{File::CREAT}[rdoc-ref:File::Constants@File-3A-3ACREAT];T@;@;0@@@0U;[i I" EXCL;TI"File::Constants::EXCL;T;0o;;[o; ;[I":{File::EXCL}[rdoc-ref:File::Constants@File-3A-3AEXCL];T@;@;0@@@0U;[i I" NONBLOCK;TI"File::Constants::NONBLOCK;T;0o;;[o; ;[I"B{File::NONBLOCK}[rdoc-ref:File::Constants@File-3A-3ANONBLOCK];T@;@;0@@@0U;[i I" TRUNC;TI"File::Constants::TRUNC;T;0o;;[o; ;[I"<{File::TRUNC}[rdoc-ref:File::Constants@File-3A-3ATRUNC];T@;@;0@@@0U;[i I"NOCTTY;TI"File::Constants::NOCTTY;T;0o;;[o; ;[I">{File::NOCTTY}[rdoc-ref:File::Constants@File-3A-3ANOCTTY];T@;@;0@@@0U;[i I"BINARY;TI"File::Constants::BINARY;T;0o;;[o; ;[I">{File::BINARY}[rdoc-ref:File::Constants@File-3A-3ABINARY];T@;@;0@@@0U;[i I"SHARE_DELETE;TI""File::Constants::SHARE_DELETE;T;0o;;[o; ;[I"J{File::SHARE_DELETE}[rdoc-ref:File::Constants@File-3A-3ASHARE_DELETE];T@;@;0@@@0U;[i I" SYNC;TI"File::Constants::SYNC;T;0o;;[o; ;[I"d{File::SYNC}[rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+and+File-3A-3ADSYNC];T@;@;0@@@0U;[i I" DSYNC;TI"File::Constants::DSYNC;T;0o;;[o; ;[I"e{File::DSYNC}[rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+and+File-3A-3ADSYNC];T@;@;0@@@0U;[i I" RSYNC;TI"File::Constants::RSYNC;T;0o;;[o; ;[I"e{File::RSYNC}[rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+and+File-3A-3ADSYNC];T@;@;0@@@0U;[i I" NOFOLLOW;TI"File::Constants::NOFOLLOW;T;0o;;[o; ;[I"B{File::NOFOLLOW}[rdoc-ref:File::Constants@File-3A-3ANOFOLLOW];T@;@;0@@@0U;[i I"NOATIME;TI"File::Constants::NOATIME;T;0o;;[o; ;[I"@{File::NOATIME}[rdoc-ref:File::Constants@File-3A-3ANOATIME];T@;@;0@@@0U;[i I"DIRECT;TI"File::Constants::DIRECT;T;0o;;[o; ;[I">{File::DIRECT}[rdoc-ref:File::Constants@File-3A-3ADIRECT];T@;@;0@@@0U;[i I"TMPFILE;TI"File::Constants::TMPFILE;T;0o;;[o; ;[I"@{File::TMPFILE}[rdoc-ref:File::Constants@File-3A-3ATMPFILE];T@;@;0@@@0U;[i I"LOCK_SH;TI"File::Constants::LOCK_SH;T;0o;;[o; ;[I"@{File::LOCK_SH}[rdoc-ref:File::Constants@File-3A-3ALOCK_SH];T@;@;0@@@0U;[i I"LOCK_EX;TI"File::Constants::LOCK_EX;T;0o;;[o; ;[I"@{File::LOCK_EX}[rdoc-ref:File::Constants@File-3A-3ALOCK_EX];T@;@;0@@@0U;[i I"LOCK_UN;TI"File::Constants::LOCK_UN;T;0o;;[o; ;[I"@{File::LOCK_UN}[rdoc-ref:File::Constants@File-3A-3ALOCK_UN];T@;@;0@@@0U;[i I"LOCK_NB;TI"File::Constants::LOCK_NB;T;0o;;[o; ;[I"@{File::LOCK_NB}[rdoc-ref:File::Constants@File-3A-3ALOCK_NB];T@;@;0@@@0U;[i I" NULL;TI"File::Constants::NULL;T;0o;;[o; ;[I":{File::NULL}[rdoc-ref:File::Constants@File-3A-3ANULL];T@;@;0@@@0[ [[I" class;T[[;[ [:protected[ [:private[ [I" instance;T[[;[ [;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@@I" File;TcRDoc::NormalClass