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