diff options
Diffstat (limited to 'lib/English.rb')
| -rw-r--r-- | lib/English.rb | 110 |
1 files changed, 46 insertions, 64 deletions
diff --git a/lib/English.rb b/lib/English.rb index ec90ff10cd..bf7896dcd6 100644 --- a/lib/English.rb +++ b/lib/English.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Include the English library file in a Ruby script, and you can -# reference the global variables such as <tt>$_</tt> using less +# reference the global variables such as <code>$_</code> using less # cryptic names, listed below. # # Without 'English': @@ -9,7 +9,7 @@ # "waterbuffalo" =~ /buff/ # print $', $$, "\n" # -# With English: +# With 'English': # # require "English" # @@ -20,31 +20,30 @@ # Below is a full list of descriptive aliases and their associated global # variable: # -# $ERROR_INFO:: $! -# $ERROR_POSITION:: $@ -# $FS:: $; -# $FIELD_SEPARATOR:: $; -# $OFS:: $, -# $OUTPUT_FIELD_SEPARATOR:: $, -# $RS:: $/ -# $INPUT_RECORD_SEPARATOR:: $/ -# $ORS:: $\ -# $OUTPUT_RECORD_SEPARATOR:: $\ -# $INPUT_LINE_NUMBER:: $. -# $NR:: $. -# $LAST_READ_LINE:: $_ -# $DEFAULT_OUTPUT:: $> -# $DEFAULT_INPUT:: $< -# $PID:: $$ -# $PROCESS_ID:: $$ -# $CHILD_STATUS:: $? -# $LAST_MATCH_INFO:: $~ -# $IGNORECASE:: $= -# $ARGV:: $* -# $MATCH:: $& -# $PREMATCH:: $` -# $POSTMATCH:: $' -# $LAST_PAREN_MATCH:: $+ +# <tt>$ERROR_INFO</tt>:: <tt>$!</tt> +# <tt>$ERROR_POSITION</tt>:: <tt>$@</tt> +# <tt>$FS</tt>:: <tt>$;</tt> +# <tt>$FIELD_SEPARATOR</tt>:: <tt>$;</tt> +# <tt>$OFS</tt>:: <tt>$,</tt> +# <tt>$OUTPUT_FIELD_SEPARATOR</tt>:: <tt>$,</tt> +# <tt>$RS</tt>:: <tt>$/</tt> +# <tt>$INPUT_RECORD_SEPARATOR</tt>:: <tt>$/</tt> +# <tt>$ORS</tt>:: <tt>$\</tt> +# <tt>$OUTPUT_RECORD_SEPARATOR</tt>:: <tt>$\</tt> +# <tt>$NR</tt>:: <tt>$.</tt> +# <tt>$INPUT_LINE_NUMBER</tt>:: <tt>$.</tt> +# <tt>$LAST_READ_LINE</tt>:: <tt>$_</tt> +# <tt>$DEFAULT_OUTPUT</tt>:: <tt>$></tt> +# <tt>$DEFAULT_INPUT</tt>:: <tt>$<</tt> +# <tt>$PID</tt>:: <tt>$$</tt> +# <tt>$PROCESS_ID</tt>:: <tt>$$</tt> +# <tt>$CHILD_STATUS</tt>:: <tt>$?</tt> +# <tt>$LAST_MATCH_INFO</tt>:: <tt>$~</tt> +# <tt>$ARGV</tt>:: <tt>$*</tt> +# <tt>$MATCH</tt>:: <tt>$&</tt> +# <tt>$PREMATCH</tt>:: <tt>$`</tt> +# <tt>$POSTMATCH</tt>:: <tt>$'</tt> +# <tt>$LAST_PAREN_MATCH</tt>:: <tt>$+</tt> # module English end if false @@ -56,87 +55,73 @@ alias $ERROR_INFO $! alias $ERROR_POSITION $@ # The default separator pattern used by String#split. May be set from -# the command line using the <tt>-F</tt> flag. +# the command line using the <code>-F</code> flag. alias $FS $; - -# The default separator pattern used by String#split. May be set from -# the command line using the <tt>-F</tt> flag. alias $FIELD_SEPARATOR $; # The separator string output between the parameters to methods such # as Kernel#print and Array#join. Defaults to +nil+, which adds no # text. -alias $OFS $, # The separator string output between the parameters to methods such # as Kernel#print and Array#join. Defaults to +nil+, which adds no # text. +alias $OFS $, alias $OUTPUT_FIELD_SEPARATOR $, # The input record separator (newline by default). This is the value # that routines such as Kernel#gets use to determine record # boundaries. If set to +nil+, +gets+ will read the entire file. alias $RS $/ - -# The input record separator (newline by default). This is the value -# that routines such as Kernel#gets use to determine record -# boundaries. If set to +nil+, +gets+ will read the entire file. alias $INPUT_RECORD_SEPARATOR $/ # The string appended to the output of every call to methods such as # Kernel#print and IO#write. The default value is +nil+. alias $ORS $\ - -# The string appended to the output of every call to methods such as -# Kernel#print and IO#write. The default value is +nil+. alias $OUTPUT_RECORD_SEPARATOR $\ # The number of the last line read from the current input file. -alias $INPUT_LINE_NUMBER $. - -# The number of the last line read from the current input file. alias $NR $. +alias $INPUT_LINE_NUMBER $. # The last line read by Kernel#gets or # Kernel#readline. Many string-related functions in the -# Kernel module operate on <tt>$_</tt> by default. The variable is +# Kernel module operate on <code>$_</code> by default. The variable is # local to the current scope. Thread local. alias $LAST_READ_LINE $_ # The destination of output for Kernel#print # and Kernel#printf. The default value is -# <tt>$stdout</tt>. +# <code>$stdout</code>. alias $DEFAULT_OUTPUT $> # An object that provides access to the concatenation # of the contents of all the files -# given as command-line arguments, or <tt>$stdin</tt> +# given as command-line arguments, or <code>$stdin</code> # (in the case where there are no -# arguments). <tt>$<</tt> supports methods similar to a +# arguments). <code>$<</code> supports methods similar to a # File object: # +inmode+, +close+, -# <tt>closed?</tt>, +each+, -# <tt>each_byte</tt>, <tt>each_line</tt>, -# +eof+, <tt>eof?</tt>, +file+, +# <code>closed?</code>, +each+, +# <code>each_byte</code>, <code>each_line</code>, +# +eof+, <code>eof?</code>, +file+, # +filename+, +fileno+, # +getc+, +gets+, +lineno+, -# <tt>lineno=</tt>, +path+, -# +pos+, <tt>pos=</tt>, +# <code>lineno=</code>, +path+, +# +pos+, <code>pos=</code>, # +read+, +readchar+, # +readline+, +readlines+, # +rewind+, +seek+, +skip+, -# +tell+, <tt>to_a</tt>, <tt>to_i</tt>, -# <tt>to_io</tt>, <tt>to_s</tt>, along with the +# +tell+, <code>to_a</code>, <code>to_i</code>, +# <code>to_io</code>, <code>to_s</code>, along with the # methods in Enumerable. The method +file+ # returns a File object for the file currently -# being read. This may change as <tt>$<</tt> reads +# being read. This may change as <code>$<</code> reads # through the files on the command line. Read only. alias $DEFAULT_INPUT $< # The process number of the program being executed. Read only. alias $PID $$ - -# The process number of the program being executed. Read only. alias $PROCESS_ID $$ # The exit status of the last child process to terminate. Read @@ -144,16 +129,13 @@ alias $PROCESS_ID $$ alias $CHILD_STATUS $? # A +MatchData+ object that encapsulates the results of a successful -# pattern match. The variables <tt>$&</tt>, <tt>$`</tt>, <tt>$'</tt>, -# and <tt>$1</tt> to <tt>$9</tt> are all derived from -# <tt>$~</tt>. Assigning to <tt>$~</tt> changes the values of these +# pattern match. The variables <code>$&</code>, <code>$`</code>, <code>$'</code>, +# and <code>$1</code> to <code>$9</code> are all derived from +# <code>$~</code>. Assigning to <code>$~</code> changes the values of these # derived variables. This variable is local to the current # scope. alias $LAST_MATCH_INFO $~ -# This variable is no longer effective. Deprecated. -alias $IGNORECASE $= - # An array of strings containing the command-line # options from the invocation of the program. Options # used by the Ruby interpreter will have been @@ -176,7 +158,7 @@ alias $PREMATCH $` alias $POSTMATCH $' # The contents of the highest-numbered group matched in the last -# successful pattern match. Thus, in <tt>"cat" =~ /(c|a)(t|z)/</tt>, -# <tt>$+</tt> will be set to "t". This variable is local to the +# successful pattern match. Thus, in <code>"cat" =~ /(c|a)(t|z)/</code>, +# <code>$+</code> will be set to "t". This variable is local to the # current scope. Read only. alias $LAST_PAREN_MATCH $+ |
