$!
| The exception information message containing the last exception raised. raise sets this variable. Access with => in a rescue clause. |
$@
| The stack backtrace of the last exception, retrievable via Exception#backtrace . |
$&
| The string matched by the last successful pattern match in this scope, or nil if the last pattern match failed. Same as m[0] where m is a MatchData object. Read only. Local. |
$'
| String preceding whatever was matched by the last successful pattern match in the current scope, or nil if the last pattern match failed. Same as m.pre_match where m is a MatchData object. Read only. Local. |
$'
| String following whatever was matched by the last successful pattern match in the current scope, or nil if the last pattern match failed. Same as m.post_match where m is a MatchData object. Read only. Local. |
$+
| Last bracket matched by the last successful search pattern, or nil if the last pattern match failed. Useful if you don't know which of a set of alternative patterns matched. Read only. Local. |
$1, $2 . . .
| Subpattern from the corresponding set of parentheses in the last successful pattern matched, not counting patterns matched in nested blocks that have been exited already, or nil if the last pattern match failed. Same as m[n] where m is a MatchData object. Read only. Local. |
$˜
| Information about the last match in the current scope. Regex#match returns the last match information. Setting this variable affects match variables like $& , $+ , $1 , $2 , etc. The nth subexpression can be retrieved by $˜[nth] . Local. |
$=
| Case-insensitive flag; nil by default. |
$/
| Input record separator, newline by default. Works like awk's RS variable. If it is set to nil , a whole file will be read at once. gets , readline , etc. take the input record separator as an optional argument. |
$\
| Output record separator for print and IO#write ; nil by default. |
$,
| Output field separator between arguments; also the default separator for Array#join , which allows you to indicate a separator explicitly. |
$;
| The default separator for String#split ; nil by default. |
$.
| The current input line number of the last file that was read. Same as ARGF.lineno . |
$<
| The virtual concatenation file of the files given by command-line arguments, or standard input (in case no argument file is supplied). $<.filename returns the current filename. Synonym for ARGF . |
$>
| Default output for print, printf , $stdout by default. Synonym for $defout . |
$_
| Last input line of string by gets or readline in the current scope; set to nil if gets or readline meets EOF. Local. |
$0
| Name of the current Ruby program being executed. |
$*
| Command-line arguments given for the script. The options for the Ruby interpreter are already removed. |
$$
| Process number (process.pid ) of the Ruby program being executed. |
$?
| Exit status of the last executed process. |
$:
| Synonym for $LOAD_PATH . |
$"
| Array containing the module names loaded by require . Used for prevent require from loading modules twice. |
$DEBUG
| True if -d or --debug switch is set. |
$defout
| Default output for print , printf ; $stdout by default. Synonym for $> . |
$F
| Receives output from split when -a specified. Set if -a is set along with -p and -n . |
$FILENAME
| Name of the file currently being read from ARGF . Same as ARGF. filename or $<. filename . |
$LOAD_PATH
| Synonym for $: . |
$SAFE
| Security level:
- 0
No checks on externally supplied (tainted) date. Default. - 1
Potentially dangerous operations using tainted data are forbidden. - 2
Potentially dangerous operations performed on processes and files are forbidden. - 3
All newly created objects are considered tainted. - 4
Modification of global data is forbidden.
|
$stdin
| The current standard input; STDIN by default. |
$stdout
| The current standard output; STDOUT by default. |
$stderr
| The current standard error output; STDERR by default. |
$VERBOSE
| True if verbose flag is set by the -v , -w , or --verbose switch of the Ruby interpreter. |
$-0
| Alias of $/ . |
$-a
| True if option -a is set. Read-only. |
$-d
| Alias of $DEBUG . |
$-F
| Alias of $; . |
$-i
| In in-place-edit mode, holds the extension, otherwise nil . Can enable or disable in-place-edit mode. |
$-I
| Alias of $: . |
$-l
| True if option -lis set. Read-only. |
$-p
| True if option -pis set. Read-only. |