diff options
Diffstat (limited to 'doc/globals.rdoc')
-rw-r--r-- | doc/globals.rdoc | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/doc/globals.rdoc b/doc/globals.rdoc index 2b4f6bd7cf..3ffe1ada5d 100644 --- a/doc/globals.rdoc +++ b/doc/globals.rdoc @@ -1,4 +1,4 @@ -== Pre-Defined Global Variables += Pre-Defined Global Variables Some of the pre-defined global variables have synonyms that are available via module Engish. @@ -8,9 +8,9 @@ To use the module: require 'English' -=== Exceptions +== Exceptions -==== <tt>$!</tt> (\Exception) +=== <tt>$!</tt> (\Exception) Contains the Exception object set by Kernel#raise: @@ -26,7 +26,7 @@ Output: English - <tt>$ERROR_INFO</tt> -==== <tt>$@</tt> (Backtrace) +=== <tt>$@</tt> (Backtrace) Same as <tt>$!.backtrace</tt>; returns an array of backtrace positions: @@ -46,7 +46,7 @@ Output: English - <tt>$ERROR_POSITION</tt>. -=== Pattern Matching +== Pattern Matching These global variables store information about the most recent successful match in the current scope. @@ -54,46 +54,46 @@ successful match in the current scope. For details and examples, see {Regexp Global Variables}[rdoc-ref:Regexp@Global+Variables]. -==== <tt>$~</tt> (\MatchData) +=== <tt>$~</tt> (\MatchData) MatchData object created from the match; thread-local and frame-local. English - <tt>$LAST_MATCH_INFO</tt>. -==== <tt>$&</tt> (Matched Substring) +=== <tt>$&</tt> (Matched Substring) The matched string. English - <tt>$MATCH</tt>. -==== <tt>$`</tt> (Pre-Match Substring) +=== <tt>$`</tt> (Pre-Match Substring) The string to the left of the match. English - <tt>$PREMATCH</tt>. -==== <tt>$'</tt> (Post-Match Substring) +=== <tt>$'</tt> (Post-Match Substring) The string to the right of the match. English - <tt>$POSTMATCH</tt>. -==== <tt>$+</tt> (Last Matched Group) +=== <tt>$+</tt> (Last Matched Group) The last group matched. English - <tt>$LAST_PAREN_MATCH</tt>. -==== <tt>$1</tt>, <tt>$2</tt>, \Etc. (Matched Group) +=== <tt>$1</tt>, <tt>$2</tt>, \Etc. (Matched Group) For <tt>$_n_</tt> the _nth_ group of the match. No \English. -=== Separators +== Separators -==== <tt>$/</tt> (Input Record Separator) +=== <tt>$/</tt> (Input Record Separator) An input record separator, initially newline. @@ -101,7 +101,7 @@ English - <tt>$INPUT_RECORD_SEPARATOR</tt>, <tt>$RS</tt>. Aliased as <tt>$-0</tt>. -==== <tt>$;</tt> (Input Field Separator) +=== <tt>$;</tt> (Input Field Separator) An input field separator, initially +nil+. @@ -109,76 +109,76 @@ English - <tt>$FIELD_SEPARATOR</tt>, <tt>$FS</tt>. Aliased as <tt>$-F</tt>. -==== <tt>$\\</tt> (Output Record Separator) +=== <tt>$\\</tt> (Output Record Separator) An output record separator, initially +nil+. English - <tt>$OUTPUT_RECORD_SEPARATOR</tt>, <tt>$ORS</tt>. -=== Streams +== Streams -==== <tt>$stdin</tt> (Standard Input) +=== <tt>$stdin</tt> (Standard Input) The current standard input stream; initially: $stdin # => #<IO:<STDIN>> -==== <tt>$stdout</tt> (Standard Output) +=== <tt>$stdout</tt> (Standard Output) The current standard output stream; initially: $stdout # => #<IO:<STDOUT>> -==== <tt>$stderr</tt> (Standard Error) +=== <tt>$stderr</tt> (Standard Error) The current standard error stream; initially: $stderr # => #<IO:<STDERR>> -==== <tt>$<</tt> (\ARGF or $stdin) +=== <tt>$<</tt> (\ARGF or $stdin) Points to stream ARGF if not empty, else to stream $stdin; read-only. English - <tt>$DEFAULT_INPUT</tt>. -==== <tt>$></tt> (Default Standard Output) +=== <tt>$></tt> (Default Standard Output) An output stream, initially <tt>$stdout</tt>. English - <tt>$DEFAULT_OUTPUT -==== <tt>$.</tt> (Input Position) +=== <tt>$.</tt> (Input Position) The input position (line number) in the most recently read stream. English - <tt>$INPUT_LINE_NUMBER</tt>, <tt>$NR</tt> -==== <tt>$_</tt> (Last Read Line) +=== <tt>$_</tt> (Last Read Line) The line (string) from the most recently read stream. English - <tt>$LAST_READ_LINE</tt>. -=== Processes +== Processes -==== <tt>$0</tt> +=== <tt>$0</tt> Initially, contains the name of the script being executed; may be reassigned. -==== <tt>$*</tt> (\ARGV) +=== <tt>$*</tt> (\ARGV) Points to ARGV. English - <tt>$ARGV</tt>. -==== <tt>$$</tt> (Process ID) +=== <tt>$$</tt> (Process ID) The process ID of the current process. Same as Process.pid. English - <tt>$PROCESS_ID</tt>, <tt>$PID</tt>. -==== <tt>$?</tt> (Child Status) +=== <tt>$?</tt> (Child Status) Initially +nil+, otherwise the Process::Status object created for the most-recently exited child process; @@ -186,7 +186,7 @@ thread-local. English - <tt>$CHILD_STATUS</tt>. -==== <tt>$LOAD_PATH</tt> (Load Path) +=== <tt>$LOAD_PATH</tt> (Load Path) Contains the array of paths to be searched by Kernel#load and Kernel#require. @@ -211,7 +211,7 @@ Examples: Aliased as <tt>$:</tt> and <tt>$-I</tt>. -==== <tt>$LOADED_FEATURES</tt> +=== <tt>$LOADED_FEATURES</tt> Contains an array of the paths to the loaded files: @@ -230,13 +230,13 @@ Contains an array of the paths to the loaded files: Aliased as <tt>$"</tt>. -=== Debugging +== Debugging -==== <tt>$FILENAME</tt> +=== <tt>$FILENAME</tt> The value returned by method ARGF.filename. -==== <tt>$DEBUG</tt> +=== <tt>$DEBUG</tt> Initially +true+ if command-line option <tt>-d</tt> or <tt>--debug</tt> is given, otherwise initially +false+; @@ -246,7 +246,7 @@ When +true+, prints each raised exception to <tt>$stderr</tt>. Aliased as <tt>$-d</tt>. -==== <tt>$VERBOSE</tt> +=== <tt>$VERBOSE</tt> Initially +true+ if command-line option <tt>-v</tt> or <tt>-w</tt> is given, otherwise initially +false+; @@ -258,58 +258,58 @@ When +nil+, disables warnings, including those from Kernel#warn. Aliased as <tt>$-v</tt> and <tt>$-w</tt>. -=== Other Variables +== Other Variables -==== <tt>$-a</tt> +=== <tt>$-a</tt> Whether command-line option <tt>-a</tt> was given; read-only. -==== <tt>$-i</tt> +=== <tt>$-i</tt> Contains the extension given with command-line option <tt>-i</tt>, or +nil+ if none. An alias of ARGF.inplace_mode. -==== <tt>$-l</tt> +=== <tt>$-l</tt> Whether command-line option <tt>-l</tt> was set; read-only. -==== <tt>$-p</tt> +=== <tt>$-p</tt> Whether command-line option <tt>-p</tt> was given; read-only. -=== Deprecated +== Deprecated -==== <tt>$=</tt> +=== <tt>$=</tt> -==== <tt>$,</tt> +=== <tt>$,</tt> -== Pre-Defined Global Constants += Pre-Defined Global Constants -== Streams += Streams -==== <tt>STDIN</tt> +=== <tt>STDIN</tt> The standard input stream (the default value for <tt>$stdin</tt>): STDIN # => #<IO:<STDIN>> -==== <tt>STDOUT</tt> +=== <tt>STDOUT</tt> The standard output stream (the default value for <tt>$stdout</tt>): STDOUT # => #<IO:<STDOUT>> -==== <tt>STDERR</tt> +=== <tt>STDERR</tt> The standard error stream (the default value for <tt>$stderr</tt>): STDERR # => #<IO:<STDERR>> -=== Enviroment +== Enviroment -==== ENV +=== ENV A hash of the contains current environment variables names and values: @@ -321,41 +321,41 @@ A hash of the contains current environment variables names and values: ["DISPLAY", ":0"], ["GDMSESSION", "ubuntu"]] -==== ARGF +=== ARGF The virtual concatenation of the files given on the command line, or from <tt>$stdin</tt> if no files were given, <tt>"-"</tt> is given, or after all files have been read. -==== <tt>ARGV</tt> +=== <tt>ARGV</tt> An array of the given command-line arguments. -==== <tt>TOPLEVEL_BINDING</tt> +=== <tt>TOPLEVEL_BINDING</tt> The Binding of the top level scope: TOPLEVEL_BINDING # => #<Binding:0x00007f58da0da7c0> -==== <tt>RUBY_VERSION</tt> +=== <tt>RUBY_VERSION</tt> The Ruby version: RUBY_VERSION # => "3.2.2" -==== <tt>RUBY_RELEASE_DATE</tt> +=== <tt>RUBY_RELEASE_DATE</tt> The release date string: RUBY_RELEASE_DATE # => "2023-03-30" -==== <tt>RUBY_PLATFORM</tt> +=== <tt>RUBY_PLATFORM</tt> The platform identifier: RUBY_PLATFORM # => "x86_64-linux" -==== <tt>RUBY_PATCHLEVEL</tt> +=== <tt>RUBY_PATCHLEVEL</tt> The integer patch level for this Ruby: @@ -363,41 +363,41 @@ The integer patch level for this Ruby: For a development build the patch level will be -1. -==== <tt>RUBY_REVISION</tt> +=== <tt>RUBY_REVISION</tt> The git commit hash for this Ruby: RUBY_REVISION # => "e51014f9c05aa65cbf203442d37fef7c12390015" -==== <tt>RUBY_COPYRIGHT</tt> +=== <tt>RUBY_COPYRIGHT</tt> The copyright string: RUBY_COPYRIGHT # => "ruby - Copyright (C) 1993-2023 Yukihiro Matsumoto" -==== <tt>RUBY_ENGINE</tt> +=== <tt>RUBY_ENGINE</tt> The name of the Ruby implementation: RUBY_ENGINE # => "ruby" -==== <tt>RUBY_ENGINE_VERSION</tt> +=== <tt>RUBY_ENGINE_VERSION</tt> The version of the Ruby implementation: RUBY_ENGINE_VERSION # => "3.2.2" -==== <tt>RUBY_DESCRIPTION</tt> +=== <tt>RUBY_DESCRIPTION</tt> The description of the Ruby implementation: RUBY_DESCRIPTION # => "ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]" -=== Embedded \Data +== Embedded \Data -==== <tt>DATA</tt> +=== <tt>DATA</tt> Defined if and only if the program has this line: |