1# Include the English library file in a Ruby script, and you can 2# reference the global variables such as \VAR{\$\_} using less 3# cryptic names, listed in the following table.% \vref{tab:english}. 4# 5# Without 'English': 6# 7# $\ = ' -- ' 8# "waterbuffalo" =~ /buff/ 9# print $", $', $$, "\n" 10# 11# With English: 12# 13# require "English" 14# 15# $OUTPUT_FIELD_SEPARATOR = ' -- ' 16# "waterbuffalo" =~ /buff/ 17# print $LOADED_FEATURES, $POSTMATCH, $PID, "\n" 18# 19# Below is a full list of descriptive aliases and their associated global 20# variable: 21# 22# $ERROR_INFO:: $! 23# $ERROR_POSITION:: $@ 24# $FS:: $; 25# $FIELD_SEPARATOR:: $; 26# $OFS:: $, 27# $OUTPUT_FIELD_SEPARATOR:: $, 28# $RS:: $/ 29# $INPUT_RECORD_SEPARATOR:: $/ 30# $ORS:: $\ 31# $OUTPUT_RECORD_SEPARATOR:: $\ 32# $INPUT_LINE_NUMBER:: $. 33# $NR:: $. 34# $LAST_READ_LINE:: $_ 35# $DEFAULT_OUTPUT:: $> 36# $DEFAULT_INPUT:: $< 37# $PID:: $$ 38# $PROCESS_ID:: $$ 39# $CHILD_STATUS:: $? 40# $LAST_MATCH_INFO:: $~ 41# $IGNORECASE:: $= 42# $ARGV:: $* 43# $MATCH:: $& 44# $PREMATCH:: $` 45# $POSTMATCH:: $' 46# $LAST_PAREN_MATCH:: $+ 47# 48module English end if false 49 50# The exception object passed to +raise+. 51alias $ERROR_INFO $! 52 53# The stack backtrace generated by the last 54# exception. <tt>See Kernel.caller</tt> for details. Thread local. 55alias $ERROR_POSITION $@ 56 57# The default separator pattern used by <tt>String.split</tt>. May be 58# set from the command line using the <tt>-F</tt> flag. 59alias $FS $; 60 61# The default separator pattern used by <tt>String.split</tt>. May be 62# set from the command line using the <tt>-F</tt> flag. 63alias $FIELD_SEPARATOR $; 64 65# The separator string output between the parameters to methods such 66# as <tt>Kernel.print</tt> and <tt>Array.join</tt>. Defaults to +nil+, 67# which adds no text. 68alias $OFS $, 69 70# The separator string output between the parameters to methods such 71# as <tt>Kernel.print</tt> and <tt>Array.join</tt>. Defaults to +nil+, 72# which adds no text. 73alias $OUTPUT_FIELD_SEPARATOR $, 74 75# The input record separator (newline by default). This is the value 76# that routines such as <tt>Kernel.gets</tt> use to determine record 77# boundaries. If set to +nil+, +gets+ will read the entire file. 78alias $RS $/ 79 80# The input record separator (newline by default). This is the value 81# that routines such as <tt>Kernel.gets</tt> use to determine record 82# boundaries. If set to +nil+, +gets+ will read the entire file. 83alias $INPUT_RECORD_SEPARATOR $/ 84 85# The string appended to the output of every call to methods such as 86# <tt>Kernel.print</tt> and <tt>IO.write</tt>. The default value is 87# +nil+. 88alias $ORS $\ 89 90# The string appended to the output of every call to methods such as 91# <tt>Kernel.print</tt> and <tt>IO.write</tt>. The default value is 92# +nil+. 93alias $OUTPUT_RECORD_SEPARATOR $\ 94 95# The number of the last line read from the current input file. 96alias $INPUT_LINE_NUMBER $. 97 98# The number of the last line read from the current input file. 99alias $NR $. 100 101# The last line read by <tt>Kernel.gets</tt> or 102# <tt>Kernel.readline</tt>. Many string-related functions in the 103# +Kernel+ module operate on <tt>$_</tt> by default. The variable is 104# local to the current scope. Thread local. 105alias $LAST_READ_LINE $_ 106 107# The destination of output for <tt>Kernel.print</tt> 108# and <tt>Kernel.printf</tt>. The default value is 109# <tt>$stdout</tt>. 110alias $DEFAULT_OUTPUT $> 111 112# An object that provides access to the concatenation 113# of the contents of all the files 114# given as command-line arguments, or <tt>$stdin</tt> 115# (in the case where there are no 116# arguments). <tt>$<</tt> supports methods similar to a 117# +File+ object: 118# +inmode+, +close+, 119# <tt>closed?</tt>, +each+, 120# <tt>each_byte</tt>, <tt>each_line</tt>, 121# +eof+, <tt>eof?</tt>, +file+, 122# +filename+, +fileno+, 123# +getc+, +gets+, +lineno+, 124# <tt>lineno=</tt>, +path+, 125# +pos+, <tt>pos=</tt>, 126# +read+, +readchar+, 127# +readline+, +readlines+, 128# +rewind+, +seek+, +skip+, 129# +tell+, <tt>to_a</tt>, <tt>to_i</tt>, 130# <tt>to_io</tt>, <tt>to_s</tt>, along with the 131# methods in +Enumerable+. The method +file+ 132# returns a +File+ object for the file currently 133# being read. This may change as <tt>$<</tt> reads 134# through the files on the command line. Read only. 135alias $DEFAULT_INPUT $< 136 137# The process number of the program being executed. Read only. 138alias $PID $$ 139 140# The process number of the program being executed. Read only. 141alias $PROCESS_ID $$ 142 143# The exit status of the last child process to terminate. Read 144# only. Thread local. 145alias $CHILD_STATUS $? 146 147# A +MatchData+ object that encapsulates the results of a successful 148# pattern match. The variables <tt>$&</tt>, <tt>$`</tt>, <tt>$'</tt>, 149# and <tt>$1</tt> to <tt>$9</tt> are all derived from 150# <tt>$~</tt>. Assigning to <tt>$~</tt> changes the values of these 151# derived variables. This variable is local to the current 152# scope. 153alias $LAST_MATCH_INFO $~ 154 155# If set to any value apart from +nil+ or +false+, all pattern matches 156# will be case insensitive, string comparisons will ignore case, and 157# string hash values will be case insensitive. Deprecated 158alias $IGNORECASE $= 159 160# An array of strings containing the command-line 161# options from the invocation of the program. Options 162# used by the Ruby interpreter will have been 163# removed. Read only. Also known simply as +ARGV+. 164alias $ARGV $* 165 166# The string matched by the last successful pattern 167# match. This variable is local to the current 168# scope. Read only. 169alias $MATCH $& 170 171# The string preceding the match in the last 172# successful pattern match. This variable is local to 173# the current scope. Read only. 174alias $PREMATCH $` 175 176# The string following the match in the last 177# successful pattern match. This variable is local to 178# the current scope. Read only. 179alias $POSTMATCH $' 180 181# The contents of the highest-numbered group matched in the last 182# successful pattern match. Thus, in <tt>"cat" =~ /(c|a)(t|z)/</tt>, 183# <tt>$+</tt> will be set to "t". This variable is local to the 184# current scope. Read only. 185alias $LAST_PAREN_MATCH $+ 186