PageRenderTime 998ms CodeModel.GetById 984ms app.highlight 9ms RepoModel.GetById 3ms app.codeStats 1ms

/tools/Ruby/lib/ruby/1.8/English.rb

http://github.com/agross/netopenspace
Ruby | 155 lines | 30 code | 25 blank | 100 comment | 0 complexity | 2be0ef74d2c28d494b630a46fa95a335 MD5 | raw file
  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
 20# The exception object passed to +raise+.
 21alias $ERROR_INFO              $!
 22
 23# The stack backtrace generated by the last
 24# exception. <tt>See Kernel.caller</tt> for details. Thread local.
 25alias $ERROR_POSITION          $@
 26
 27# The default separator pattern used by <tt>String.split</tt>.  May be
 28# set from the command line using the <tt>-F</tt> flag.
 29alias $FS                      $;
 30
 31# The default separator pattern used by <tt>String.split</tt>.  May be
 32# set from the command line using the <tt>-F</tt> flag.
 33alias $FIELD_SEPARATOR         $;
 34
 35# The separator string output between the parameters to methods such
 36# as <tt>Kernel.print</tt> and <tt>Array.join</tt>. Defaults to +nil+,
 37# which adds no text.
 38alias $OFS                     $,
 39
 40# The separator string output between the parameters to methods such
 41# as <tt>Kernel.print</tt> and <tt>Array.join</tt>. Defaults to +nil+,
 42# which adds no text.
 43alias $OUTPUT_FIELD_SEPARATOR  $,
 44
 45# The input record separator (newline by default). This is the value
 46# that routines such as <tt>Kernel.gets</tt> use to determine record
 47# boundaries. If set to +nil+, +gets+ will read the entire file.
 48alias $RS                      $/
 49
 50# The input record separator (newline by default). This is the value
 51# that routines such as <tt>Kernel.gets</tt> use to determine record
 52# boundaries. If set to +nil+, +gets+ will read the entire file.
 53alias $INPUT_RECORD_SEPARATOR  $/
 54
 55# The string appended to the output of every call to methods such as
 56# <tt>Kernel.print</tt> and <tt>IO.write</tt>. The default value is
 57# +nil+.
 58alias $ORS                     $\
 59
 60# The string appended to the output of every call to methods such as
 61# <tt>Kernel.print</tt> and <tt>IO.write</tt>. The default value is
 62# +nil+.
 63alias $OUTPUT_RECORD_SEPARATOR $\
 64
 65# The number of the last line read from the current input file.
 66alias $INPUT_LINE_NUMBER       $.
 67
 68# The number of the last line read from the current input file.
 69alias $NR                      $.
 70
 71# The last line read by <tt>Kernel.gets</tt> or
 72# <tt>Kernel.readline</tt>. Many string-related functions in the
 73# +Kernel+ module operate on <tt>$_</tt> by default. The variable is
 74# local to the current scope. Thread local.
 75alias $LAST_READ_LINE          $_
 76
 77# The destination of output for <tt>Kernel.print</tt>
 78# and <tt>Kernel.printf</tt>. The default value is
 79# <tt>$stdout</tt>.
 80alias $DEFAULT_OUTPUT          $>
 81
 82# An object that provides access to the concatenation
 83# of the contents of all the files
 84# given as command-line arguments, or <tt>$stdin</tt>
 85# (in the case where there are no
 86# arguments). <tt>$<</tt> supports methods similar to a 
 87# +File+ object:
 88# +inmode+, +close+,
 89# <tt>closed?</tt>, +each+,
 90# <tt>each_byte</tt>, <tt>each_line</tt>,
 91# +eof+, <tt>eof?</tt>, +file+,
 92# +filename+, +fileno+,
 93# +getc+, +gets+, +lineno+,
 94# <tt>lineno=</tt>, +path+, 
 95# +pos+, <tt>pos=</tt>,
 96# +read+, +readchar+,
 97# +readline+, +readlines+,
 98# +rewind+, +seek+, +skip+,
 99# +tell+, <tt>to_a</tt>, <tt>to_i</tt>,
100# <tt>to_io</tt>, <tt>to_s</tt>, along with the
101# methods in +Enumerable+. The method +file+
102# returns a +File+ object for the file currently
103# being read. This may change as <tt>$<</tt> reads
104# through the files on the command line. Read only.
105alias $DEFAULT_INPUT           $<
106
107# The process number of the program being executed. Read only.
108alias $PID                     $$
109
110# The process number of the program being executed. Read only.
111alias $PROCESS_ID              $$
112
113# The exit status of the last child process to terminate. Read
114# only. Thread local.
115alias $CHILD_STATUS            $?
116
117# A +MatchData+ object that encapsulates the results of a successful
118# pattern match. The variables <tt>$&</tt>, <tt>$`</tt>, <tt>$'</tt>,
119# and <tt>$1</tt> to <tt>$9</tt> are all derived from
120# <tt>$~</tt>. Assigning to <tt>$~</tt> changes the values of these
121# derived variables.  This variable is local to the current
122# scope. Thread local.
123alias $LAST_MATCH_INFO         $~
124
125# If set to any value apart from +nil+ or +false+, all pattern matches
126# will be case insensitive, string comparisons will ignore case, and
127# string hash values will be case insensitive. Deprecated
128alias $IGNORECASE              $=
129
130# An array of strings containing the command-line
131# options from the invocation of the program. Options
132# used by the Ruby interpreter will have been
133# removed. Read only. Also known simply as +ARGV+.
134alias $ARGV                    $*
135
136# The string matched by the last successful pattern
137# match. This variable is local to the current
138# scope. Read only. Thread local.
139alias $MATCH                   $&
140
141# The string preceding the match in the last
142# successful pattern match. This variable is local to 
143# the current scope. Read only. Thread local.
144alias $PREMATCH                $`
145
146# The string following the match in the last
147# successful pattern match. This variable is local to 
148# the current scope. Read only. Thread local.
149alias $POSTMATCH               $'
150
151# The contents of the highest-numbered group matched in the last
152# successful pattern match. Thus, in <tt>"cat" =~ /(c|a)(t|z)/</tt>,
153# <tt>$+</tt> will be set to "t".  This variable is local to the
154# current scope. Read only. Thread local.
155alias $LAST_PAREN_MATCH        $+