Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Ruby / Yukihiro Matsumoto_Programming Ruby.doc
Скачиваний:
121
Добавлен:
06.06.2015
Размер:
2.71 Mб
Скачать

Execution Environment Variables

$0

String

The name of the top-level Ruby program being executed. Typically this will be the program's filename. On some operating systems, assigning to this variable will change the name of the process reported (for example) by the ps(1)command.

$*

Array

An array of strings containing the command-line options from the invocation of the program. Options used by the Ruby interpreter will have been removed. {}

$"

Array

An array containing the filenames of modules loaded by require. {}

$$

Fixnum

The process number of the program being executed. {}

$?

Fixnum

The exit status of the last child process to terminate. {}

$:

Array

An array of strings, where each string specifies a directory to be searched for Ruby scripts and binary extensions used by the loadandrequiremethods. The initial value is the value of the arguments passed via the-Icommand-line option, followed by an installation-defined standard library location, followed by the current directory (``.''). This variable may be set from within a program to alter the default search path; typically, programs use$: << dirto appenddirto the path. {}

$-a

Object

True if the -aoption is specified on the command line. {}

$-d

Object

Synonym for $DEBUG.

$DEBUG

Object

Set to trueif the-dcommand-line option is specified.

__FILE__

String

The name of the current source file. {}

$F

Array

The array that receives the split input line if the -acommand-line option is used.

$FILENAME

String

The name of the current input file. Equivalent to $<.filename. {}

$-i

String

If in-place edit mode is enabled (perhaps using the -icommand-line option),$-iholds the extension used when creating the backup file. If you set a value into$-i, enables in-place edit mode. See page 136.

$-I

Array

Synonym for $:. {}

$-K

String

Sets the multibyte coding system for strings and regular expressions. Equivalent to the -Kcommand-line option. See page 137.

$-l

Object

Set to trueif the-loption (which enables line-end processing) is present on the command line. See page 137. {}

__LINE__

String

The current line number in the source file. {}

$LOAD_PATH

Array

A synonym for $:. {}

$-p

Object

Set to trueif the-poption (which puts an implicitwhile gets...endloop around your program) is present on the command line. See page 137. {}

$SAFE

Fixnum

The current safe level (see page 254). This variable's value may never be reduced by assignment. {}

$VERBOSE

Object

Set to trueif the-v,--version, or-woption is specified on the command line. Setting this option totruecauses the interpreter and some library routines to report additional information.

$-v

Object

Synonym for $VERBOSE.

$-w

Object

Synonym for $VERBOSE.

Соседние файлы в папке Ruby