D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Filename :
page-globals_rdoc.ri
back
Copy
U:RDoc::TopLevel[ i I"globals.rdoc:ETcRDoc::Parser::Simpleo:RDoc::Markup::Document:@parts[BS:RDoc::Markup::Heading: leveli: textI"!Pre-Defined Global Variables;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"<Some of the pre-defined global variables have synonyms ;TI",that are available via module English. ;TI"6For each of those, the \English synonym is given.;T@ o; ;[I"To use the module:;T@ o:RDoc::Markup::Verbatim;[I"require 'English' ;T:@format0S; ; i;I"Exceptions;T@ S; ; i;I"<tt>$!</tt> (\Exception);T@ o; ;[I"7Contains the Exception object set by Kernel#raise:;T@ o;;[ I"begin ;TI"& raise RuntimeError.new('Boo!') ;TI"rescue RuntimeError ;TI" p $! ;TI" end ;T;0o; ;[I"Output:;T@ o;;[I"#<RuntimeError: Boo!> ;T;0o; ;[I"#English - <tt>$ERROR_INFO</tt>;T@ S; ; i;I"<tt>$@</tt> (Backtrace);T@ o; ;[I"$Same as <tt>$!.backtrace</tt>; ;TI"-returns an array of backtrace positions:;T@ o;;[ I"begin ;TI"& raise RuntimeError.new('Boo!') ;TI"rescue RuntimeError ;TI" pp $@.take(4) ;TI" end ;T;0o; ;[I"Output:;T@ o;;[ I")["(irb):338:in `<top (required)>'", ;TI"F "/snap/ruby/317/lib/ruby/3.2.0/irb/workspace.rb:119:in `eval'", ;TI"J "/snap/ruby/317/lib/ruby/3.2.0/irb/workspace.rb:119:in `evaluate'", ;TI"H "/snap/ruby/317/lib/ruby/3.2.0/irb/context.rb:502:in `evaluate'"] ;T;0o; ;[I"(English - <tt>$ERROR_POSITION</tt>.;T@ S; ; i;I"Pattern Matching;T@ o; ;[I"DThese global variables store information about the most recent ;TI"+successful match in the current scope.;T@ o; ;[I"For details and examples, ;TI"Esee {Regexp Global Variables}[rdoc-ref:Regexp@Global+Variables].;T@ S; ; i;I"<tt>$~</tt> (\MatchData);T@ o; ;[I".MatchData object created from the match; ;TI""thread-local and frame-local.;T@ o; ;[I")English - <tt>$LAST_MATCH_INFO</tt>.;T@ S; ; i;I"$<tt>$&</tt> (Matched Substring);T@ o; ;[I"The matched string.;T@ o; ;[I"English - <tt>$MATCH</tt>.;T@ S; ; i;I"&<tt>$`</tt> (Pre-Match Substring);T@ o; ;[I")The string to the left of the match.;T@ o; ;[I""English - <tt>$PREMATCH</tt>.;T@ S; ; i;I"'<tt>$'</tt> (Post-Match Substring);T@ o; ;[I"*The string to the right of the match.;T@ o; ;[I"#English - <tt>$POSTMATCH</tt>.;T@ S; ; i;I"%<tt>$+</tt> (Last Matched Group);T@ o; ;[I"The last group matched.;T@ o; ;[I"*English - <tt>$LAST_PAREN_MATCH</tt>.;T@ S; ; i;I"4<tt>$1</tt>, <tt>$2</tt>, \Etc. (Matched Group);T@ o; ;[I"4For <tt>$_n_</tt> the _nth_ group of the match.;T@ o; ;[I"No \English.;T@ S; ; i;I"Separators;T@ S; ; i;I")<tt>$/</tt> (Input Record Separator);T@ o; ;[I"2An input record separator, initially newline.;T@ o; ;[I">English - <tt>$INPUT_RECORD_SEPARATOR</tt>, <tt>$RS</tt>.;T@ o; ;[I"Aliased as <tt>$-0</tt>.;T@ S; ; i;I"+<tt>$\\</tt> (Output Record Separator);T@ o; ;[I"1An output record separator, initially +nil+.;T@ o; ;[I"@English - <tt>$OUTPUT_RECORD_SEPARATOR</tt>, <tt>$ORS</tt>.;T@ S; ; i;I"Streams;T@ S; ; i;I"%<tt>$stdin</tt> (Standard Input);T@ o; ;[I"2The current standard input stream; initially:;T@ o;;[I"$stdin # => #<IO:<STDIN>> ;T;0S; ; i;I"'<tt>$stdout</tt> (Standard Output);T@ o; ;[I"3The current standard output stream; initially:;T@ o;;[I"!$stdout # => #<IO:<STDOUT>> ;T;0S; ; i;I"&<tt>$stderr</tt> (Standard Error);T@ o; ;[I"2The current standard error stream; initially:;T@ o;;[I"!$stderr # => #<IO:<STDERR>> ;T;0S; ; i;I""<tt>$<</tt> (\ARGF or $stdin);T@ o; ;[I"JPoints to stream ARGF if not empty, else to stream $stdin; read-only.;T@ o; ;[I"'English - <tt>$DEFAULT_INPUT</tt>.;T@ S; ; i;I"*<tt>$></tt> (Default Standard Output);T@ o; ;[I"2An output stream, initially <tt>$stdout</tt>.;T@ o; ;[I""English - <tt>$DEFAULT_OUTPUT;T@ S; ; i;I"!<tt>$.</tt> (Input Position);T@ o; ;[I"GThe input position (line number) in the most recently read stream.;T@ o; ;[I"8English - <tt>$INPUT_LINE_NUMBER</tt>, <tt>$NR</tt>;T@ S; ; i;I"!<tt>$_</tt> (Last Read Line);T@ o; ;[I":The line (string) from the most recently read stream.;T@ o; ;[I"(English - <tt>$LAST_READ_LINE</tt>.;T@ S; ; i;I"Processes;T@ S; ; i;I"<tt>$0</tt>;T@ o; ;[I"@Initially, contains the name of the script being executed; ;TI"may be reassigned.;T@ S; ; i;I"<tt>$*</tt> (\ARGV);T@ o; ;[I"Points to ARGV.;T@ o; ;[I"English - <tt>$ARGV</tt>.;T@ S; ; i;I"<tt>$$</tt> (Process ID);T@ o; ;[I"@The process ID of the current process. Same as Process.pid.;T@ o; ;[I"3English - <tt>$PROCESS_ID</tt>, <tt>$PID</tt>.;T@ S; ; i;I"<tt>$?</tt> (Child Status);T@ o; ;[I";Initially +nil+, otherwise the Process::Status object ;TI"9created for the most-recently exited child process; ;TI"thread-local.;T@ o; ;[I"&English - <tt>$CHILD_STATUS</tt>.;T@ S; ; i;I"$<tt>$LOAD_PATH</tt> (Load Path);T@ o; ;[I"0Contains the array of paths to be searched ;TI"'by Kernel#load and Kernel#require.;T@ o; ;[I"HSingleton method <tt>$LOAD_PATH.resolve_feature_path(feature)</tt> ;TI" returns:;T@ o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"G<tt>[:rb, _path_]</tt>, where +path+ is the path to the Ruby file ;TI"*to be loaded for the given +feature+.;To;;0;[o; ;[I"P<tt>[:so+ _path_]</tt>, where +path+ is the path to the shared object file ;TI"*to be loaded for the given +feature+.;To;;0;[o; ;[I"4+nil+ if there is no such +feature+ and +path+.;T@ o; ;[I"Examples:;T@ o;;[I"0$LOAD_PATH.resolve_feature_path('timeout') ;TI"<# => [:rb, "/snap/ruby/317/lib/ruby/3.2.0/timeout.rb"] ;TI"2$LOAD_PATH.resolve_feature_path('date_core') ;TI"K# => [:so, "/snap/ruby/317/lib/ruby/3.2.0/x86_64-linux/date_core.so"] ;TI",$LOAD_PATH.resolve_feature_path('foo') ;TI"# => nil ;T;0o; ;[I"-Aliased as <tt>$:</tt> and <tt>$-I</tt>.;T@ S; ; i;I"<tt>$LOADED_FEATURES</tt>;T@ o; ;[I"8Contains an array of the paths to the loaded files:;T@ o;;[I"$LOADED_FEATURES.take(10) ;TI" # => ;TI"["enumerator.so", ;TI" "thread.rb", ;TI" "fiber.so", ;TI" "rational.so", ;TI" "complex.so", ;TI" "ruby2_keywords.rb", ;TI"A "/snap/ruby/317/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so", ;TI"I "/snap/ruby/317/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so", ;TI"@ "/snap/ruby/317/lib/ruby/3.2.0/x86_64-linux/rbconfig.rb", ;TI"A "/snap/ruby/317/lib/ruby/3.2.0/rubygems/compatibility.rb"] ;T;0o; ;[I"Aliased as <tt>$"</tt>.;T@ S; ; i;I"Debugging;T@ S; ; i;I"<tt>$FILENAME</tt>;T@ o; ;[I"0The value returned by method ARGF.filename.;T@ S; ; i;I"<tt>$DEBUG</tt>;T@ o; ;[I"WInitially +true+ if command-line option <tt>-d</tt> or <tt>--debug</tt> is given, ;TI""otherwise initially +false+; ;TI"7may be set to either value in the running program.;T@ o; ;[I"CWhen +true+, prints each raised exception to <tt>$stderr</tt>.;T@ o; ;[I"Aliased as <tt>$-d</tt>.;T@ S; ; i;I"<tt>$VERBOSE</tt>;T@ o; ;[I"RInitially +true+ if command-line option <tt>-v</tt> or <tt>-w</tt> is given, ;TI""otherwise initially +false+; ;TI"Emay be set to either value, or to +nil+, in the running program.;T@ o; ;[I"(When +true+, enables Ruby warnings.;T@ o; ;[I"EWhen +nil+, disables warnings, including those from Kernel#warn.;T@ o; ;[I".Aliased as <tt>$-v</tt> and <tt>$-w</tt>.;T@ S; ; i;I"Other Variables;T@ S; ; i;I"<tt>$-a</tt>;T@ o; ;[I"BWhether command-line option <tt>-a</tt> was given; read-only.;T@ S; ; i;I"<tt>$-i</tt>;T@ o; ;[I"HContains the extension given with command-line option <tt>-i</tt>, ;TI"or +nil+ if none.;T@ o; ;[I"#An alias of ARGF.inplace_mode.;T@ S; ; i;I"<tt>$-l</tt>;T@ o; ;[I"@Whether command-line option <tt>-l</tt> was set; read-only.;T@ S; ; i;I"<tt>$-p</tt>;T@ o; ;[I"BWhether command-line option <tt>-p</tt> was given; read-only.;T@ S; ; i;I"Deprecated;T@ S; ; i;I"<tt>$=</tt>;T@ S; ; i;I"<tt>$,</tt>;T@ S; ; i;I"<tt>$;</tt>;T@ S; ; i;I"!Pre-Defined Global Constants;T@ S; ; i;I"Streams;T@ S; ; i;I"<tt>STDIN</tt>;T@ o; ;[I"GThe standard input stream (the default value for <tt>$stdin</tt>):;T@ o;;[I"STDIN # => #<IO:<STDIN>> ;T;0S; ; i;I"<tt>STDOUT</tt>;T@ o; ;[I"IThe standard output stream (the default value for <tt>$stdout</tt>):;T@ o;;[I" STDOUT # => #<IO:<STDOUT>> ;T;0S; ; i;I"<tt>STDERR</tt>;T@ o; ;[I"HThe standard error stream (the default value for <tt>$stderr</tt>):;T@ o;;[I" STDERR # => #<IO:<STDERR>> ;T;0S; ; i;I"Environment;T@ S; ; i;I"ENV;T@ o; ;[I"KA hash of the contains current environment variables names and values:;T@ o;;[I"ENV.take(5) ;TI" # => ;TI""[["COLORTERM", "truecolor"], ;TI"D ["DBUS_SESSION_BUS_ADDRESS", "unix:path=/run/user/1000/bus"], ;TI"% ["DESKTOP_SESSION", "ubuntu"], ;TI" ["DISPLAY", ":0"], ;TI" ["GDMSESSION", "ubuntu"]] ;T;0S; ; i;I" ARGF;T@ o; ;[I"OThe virtual concatenation of the files given on the command line, or from ;TI"M<tt>$stdin</tt> if no files were given, <tt>"-"</tt> is given, or after ;TI"all files have been read.;T@ S; ; i;I"<tt>ARGV</tt>;T@ o; ;[I"2An array of the given command-line arguments.;T@ S; ; i;I"<tt>TOPLEVEL_BINDING</tt>;T@ o; ;[I"(The Binding of the top level scope:;T@ o;;[I"9TOPLEVEL_BINDING # => #<Binding:0x00007f58da0da7c0> ;T;0S; ; i;I"<tt>RUBY_VERSION</tt>;T@ o; ;[I"The Ruby version:;T@ o;;[I"RUBY_VERSION # => "3.2.2" ;T;0S; ; i;I"<tt>RUBY_RELEASE_DATE</tt>;T@ o; ;[I"The release date string:;T@ o;;[I")RUBY_RELEASE_DATE # => "2023-03-30" ;T;0S; ; i;I"<tt>RUBY_PLATFORM</tt>;T@ o; ;[I"The platform identifier:;T@ o;;[I"'RUBY_PLATFORM # => "x86_64-linux" ;T;0S; ; i;I"<tt>RUBY_PATCHLEVEL</tt>;T@ o; ;[I"+The integer patch level for this Ruby:;T@ o;;[I"RUBY_PATCHLEVEL # => 53 ;T;0o; ;[I"8For a development build the patch level will be -1.;T@ S; ; i;I"<tt>RUBY_REVISION</tt>;T@ o; ;[I"'The git commit hash for this Ruby:;T@ o;;[I"CRUBY_REVISION # => "e51014f9c05aa65cbf203442d37fef7c12390015" ;T;0S; ; i;I"<tt>RUBY_COPYRIGHT</tt>;T@ o; ;[I"The copyright string:;T@ o;;[I"RUBY_COPYRIGHT ;TI"># => "ruby - Copyright (C) 1993-2023 Yukihiro Matsumoto" ;T;0S; ; i;I"<tt>RUBY_ENGINE</tt>;T@ o; ;[I")The name of the Ruby implementation:;T@ o;;[I"RUBY_ENGINE # => "ruby" ;T;0S; ; i;I"!<tt>RUBY_ENGINE_VERSION</tt>;T@ o; ;[I",The version of the Ruby implementation:;T@ o;;[I"&RUBY_ENGINE_VERSION # => "3.2.2" ;T;0S; ; i;I"<tt>RUBY_DESCRIPTION</tt>;T@ o; ;[I"0The description of the Ruby implementation:;T@ o;;[I"RUBY_DESCRIPTION ;TI"G# => "ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]" ;T;0S; ; i;I"Embedded \Data;T@ S; ; i;I"<tt>DATA</tt>;T@ o; ;[I"6Defined if and only if the program has this line:;T@ o;;[I" __END__ ;T;0o; ;[I"2When defined, <tt>DATA</tt> is a File object ;TI":containing the lines following the <tt>__END__</tt>, ;TI",positioned at the first of those lines:;T@ o;;[I"p DATA ;TI"&DATA.each_line { |line| p line } ;TI" __END__ ;TI" Foo ;TI" Bar ;TI" Baz ;T;0o; ;[I"Output:;T@ o;;[ I"#<File:t.rb> ;TI" "Foo\n" ;TI" "Bar\n" ;TI""Baz\n";T;0: @file@:0@omit_headings_from_table_of_contents_below0