Ruby: List of Predefined Global Variables
|◇||name of the Ruby script file currently executing|
|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. Read only. Also known simply as +ARGV+.|
|◇||Load path for scripts and binary modules by load or require.|
|The exception object passed to +raise+|
|The stack backtrace generated by the last exception. |
|The default separator pattern used by |
|The separator string output between the parameters to methods such as |
|The input record separator (newline by default). This is the value that routines such as |
|The string appended to the output of every call to methods such as |
|The number of the last line read from the current input file.|
|The last line read by |
|The destination of output for |
|An object that provides access to the concatenation of the contents of all the files given as command-line arguments, or |
|The process number of the program being executed. Read only.|
|The exit status of the last child process to terminate. Read only. Thread local.|
|If set to any value apart from +nil+ or +false+, all pattern matches will be case insensitive, string comparisons will ignore case, and string hash values will be case insensitive. Deprecated|
|A +MatchData+ object that encapsulates the results of a successful pattern match. The variables |
|The string matched by the last successful pattern match. This variable is local to the current scope. Read only. Thread local.|
|The string preceding the match in the last successful pattern match. This variable is local to the current scope. Read only. Thread local.|
|The string following the match in the last successful pattern match. This variable is local to the current scope. Read only. Thread local.|
|The contents of the highest-numbered group matched in the last successful pattern match. Thus, in |
Where in the doc are those predefined vars?
in Ruby 2, it's documented at http://ruby-doc.org/core-2.0/doc/globals_rdoc.html.
for Ruby 1.9.3, it's not really documented. The closest is http://www.ruby-doc.org/stdlib-1.9.3/libdoc/English/rdoc/Object.html but the doc is empty.
You might read the file. Do
print $: to locate the search path. Then, search for file
- If you read the file
English.rb, you see the use of
$LOADED_FEATURES, but that isn't defined in the file.
- Also, the file doesn't contain
$:, which is supposedly the lib search path.
Ask me question on patreon