Maintenance of Ruby 2.0.0 ended on February 24, 2016. Read more

In Files

  • dir.c
  • file.c

File::Constants

File::Constants provides file-related constants. All possible file constants are listed in the documentation but they may not all be present on your platform.

If the underlying platform doesn't define a constant the corresponding Ruby constant is not defined.

Your platform documentations (e.g. man open(2)) may describe more detailed information.

Constants

APPEND

append on each write

BINARY

disable line code conversion

CREAT

create file if it does not exist

DIRECT

Try to minimize cache effects of the I/O to and from this file.

DSYNC

any write operation perform synchronously except some meta data

EXCL

error if CREAT and the file exists

FNM_CASEFOLD
FNM_DOTMATCH
FNM_EXTGLOB
FNM_NOESCAPE
FNM_PATHNAME
FNM_SYSCASE
LOCK_EX

exclusive lock. see File#flock

LOCK_NB

non-blocking lock. used with LOCK_SH or LOCK_EX. see File#flock

LOCK_SH

shared lock. see File#flock

LOCK_UN

unlock. see File#flock

NOATIME

do not change atime

NOCTTY

not to make opened IO the controlling terminal device

NOFOLLOW

do not follow symlinks

NONBLOCK

do not block on open or for data to become available

NULL

Name of the null device

RDONLY

open for reading only

RDWR

open for reading and writing

RSYNC

any read operation perform synchronously. used with SYNC or DSYNC.

SYNC

any write operation perform synchronously

TRUNC

truncate size to 0

WRONLY

open for writing only