ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PK]%!!pretty_inspect-i.rinu[U:RDoc::AnyMethod[iI"pretty_inspect:ETI"Kernel#pretty_inspect;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"1Returns a pretty printed object as a string.;To:RDoc::Markup::BlankLineo; ; [I"FIn order to use this method you must first require the PP module:;T@o:RDoc::Markup::Verbatim; [I"require 'pp' ;T: @format0o; ; [I",See the PP module for more information.;T: @fileI"lib/pp.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]SXG~~ fork-i.rinu[U:RDoc::AnyMethod[iI" fork:ETI"Kernel#fork;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"FCreates a subprocess. If a block is specified, that block is run ;TI"Gin the subprocess, and the subprocess terminates with a status of ;TI"Azero. Otherwise, the +fork+ call returns twice, once in the ;TI"Dparent, returning the process ID of the child, and once in the ;TI">child, returning _nil_. The child process can exit using ;TI"at_exit ;TI"Ffunctions. The parent process should use Process.wait to collect ;TI"Gthe termination statuses of its children or use Process.detach to ;TI"Dregister disinterest in their status; otherwise, the operating ;TI",system may accumulate zombie processes.;To:RDoc::Markup::BlankLineo; ; [I"NThe thread calling fork is the only thread in the created child process. ;TI"%fork doesn't copy other threads.;T@o; ; [I"EIf fork is not usable, Process.respond_to?(:fork) returns false.;T@o; ; [I"UNote that fork(2) is not available on some platforms like Windows and NetBSD 4. ;TI"8Therefore you should use spawn() instead of fork().;T: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"_Kernel.fork [{ block }] -> integer or nil Process.fork [{ block }] -> integer or nil ;T0[I"();T@#FI" Kernel;TcRDoc::NormalModule00PK]F; :: raise-i.rinu[U:RDoc::AnyMethod[iI" raise:ETI"Kernel#raise;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JWith no arguments, raises the exception in $! or raises ;TI"Ia RuntimeError if $! is +nil+. With a single +String+ ;TI"Pargument, raises a +RuntimeError+ with the string as a message. Otherwise, ;TI"Dthe first parameter should be an +Exception+ class (or another ;TI"Hobject that returns an +Exception+ object when sent an +exception+ ;TI"Omessage). The optional second parameter sets the message associated with ;TI"Othe exception (accessible via Exception#message), and the third parameter ;TI"Ois an array of callback information (accessible via Exception#backtrace). ;TI"MThe +cause+ of the generated exception (accessible via Exception#cause) ;TI"Pis automatically set to the "current" exception ($!), if any. ;TI"IAn alternative value, either an +Exception+ object or +nil+, can be ;TI")specified via the +:cause+ argument.;To:RDoc::Markup::BlankLineo; ; [I"5Exceptions are caught by the +rescue+ clause of ;TI"%begin...end blocks.;T@o:RDoc::Markup::Verbatim; [I"%raise "Failed to create socket" ;TI"1raise ArgumentError, "No parameters", caller;T: @format0: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below0I"raise raise(string, cause: $!) raise(exception [, string [, array]], cause: $!) fail fail(string, cause: $!) fail(exception [, string [, array]], cause: $!) ;T0[[I" fail;T@ I" (*args);T@"FI" Kernel;TcRDoc::NormalModule00PK] `` Rational-i.rinu[U:RDoc::AnyMethod[iI" Rational:ETI"Kernel#Rational;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"*Returns +x/y+ or +arg+ as a Rational.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I" Rational(2, 3) #=> (2/3) ;TI" Rational(5) #=> (5/1) ;TI" Rational(0.5) #=> (1/2) ;TI"?Rational(0.3) #=> (5404319552844595/18014398509481984) ;TI" ;TI" Rational("2/3") #=> (2/3) ;TI"!Rational("0.3") #=> (3/10) ;TI" ;TI"-Rational("10 cents") #=> ArgumentError ;TI")Rational(nil) #=> TypeError ;TI")Rational(1, nil) #=> TypeError ;TI" ;TI"5Rational("10 cents", exception: false) #=> nil ;T: @format0o; ; [I"Syntax of the string form:;T@o; ; [I" rational or nil Rational(arg, exception: true) -> rational or nil ;T0[I"(p1, p2 = v2, p3 = {});T@1FI" Kernel;TcRDoc::NormalModule00PK]PKB Hash-i.rinu[U:RDoc::AnyMethod[iI" Hash:ETI"Kernel#Hash;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Converts arg to a Hash by calling ;TI"Aarg.to_hash. Returns an empty Hash when ;TI"/arg is nil or [].;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"Hash([]) #=> {} ;TI"Hash(nil) #=> {} ;TI",Hash(key: :value) #=> {:key => :value} ;TI"$Hash([1, 2, 3]) #=> TypeError;T: @format0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"Hash(arg) -> hash ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00PK]C,3,3 format-i.rinu[U:RDoc::AnyMethod[iI" format:ETI"Kernel#format;TF: privateo:RDoc::Markup::Document: @parts[&o:RDoc::Markup::Paragraph; [I"HReturns the string resulting from applying format_string to ;TI"Iany additional arguments. Within the format string, any characters ;TI":other than format sequences are copied to the result.;To:RDoc::Markup::BlankLineo; ; [I"3The syntax of a format sequence is as follows.;T@o:RDoc::Markup::Verbatim; [I"%%[flags][width][.precision]type ;T: @format0o; ; [ I"A format ;TI"Fsequence consists of a percent sign, followed by optional flags, ;TI"Hwidth, and precision indicators, then terminated with a field type ;TI"?character. The field type controls how the corresponding ;TI"Isprintf argument is to be interpreted, while the flags ;TI" modify that interpretation.;T@o; ; [I"#The field type characters are:;T@o; ; [6I"Field | Integer Format ;TI"K------+-------------------------------------------------------------- ;TI"2 b | Convert argument as a binary number. ;TI"F | Negative numbers will be displayed as a two's complement ;TI"" | prefixed with `..1'. ;TI"D B | Equivalent to `b', but uses an uppercase 0B for prefix ;TI"- | in the alternative format by #. ;TI"3 d | Convert argument as a decimal number. ;TI" i | Identical to `d'. ;TI"2 o | Convert argument as an octal number. ;TI"F | Negative numbers will be displayed as a two's complement ;TI"" | prefixed with `..7'. ;TI" u | Identical to `d'. ;TI"7 x | Convert argument as a hexadecimal number. ;TI"F | Negative numbers will be displayed as a two's complement ;TI"E | prefixed with `..f' (representing an infinite string of ;TI" | leading 'ff's). ;TI"< X | Equivalent to `x', but uses uppercase letters. ;TI" ;TI"Field | Float Format ;TI"K------+-------------------------------------------------------------- ;TI"G e | Convert floating point argument into exponential notation ;TI"L | with one digit before the decimal point as [-]d.dddddde[+-]dd. ;TI"L | The precision specifies the number of digits after the decimal ;TI"( | point (defaulting to six). ;TI"D E | Equivalent to `e', but uses an uppercase E to indicate ;TI" | the exponent. ;TI"? f | Convert floating point argument as [-]ddd.dddddd, ;TI"F | where the precision specifies the number of digits after ;TI" | the decimal point. ;TI"D g | Convert a floating point number using exponential form ;TI"@ | if the exponent is less than -4 or greater than or ;TI"C | equal to the precision, or in dd.dddd form otherwise. ;TI"G | The precision specifies the number of significant digits. ;TI"K G | Equivalent to `g', but use an uppercase `E' in exponent form. ;TI"D a | Convert floating point argument as [-]0xh.hhhhp[+-]dd, ;TI"H | which is consisted from optional sign, "0x", fraction part ;TI"C | as hexadecimal, "p", and exponential part as decimal. ;TI"? A | Equivalent to `a', but use uppercase `X' and `P'. ;TI" ;TI"Field | Other Format ;TI"K------+-------------------------------------------------------------- ;TI"D c | Argument is the numeric code for a single character or ;TI"/ | a single character string itself. ;TI". p | The valuing of argument.inspect. ;TI"D s | Argument is a string to be substituted. If the format ;TI"I | sequence contains a precision, at most that many characters ;TI" | will be copied. ;TI"J % | A percent sign itself will be displayed. No argument taken. ;T; 0o; ; [I"5The flags modifies the behavior of the formats. ;TI"The flag characters are:;T@o; ; [/I"(Flag | Applies to | Meaning ;TI"I---------+---------------+----------------------------------------- ;TI">space | bBdiouxX | Leave a space at the start of ;TI"6 | aAeEfgG | non-negative numbers. ;TI"D | (numeric fmt) | For `o', `x', `X', `b' and `B', use ;TI"E | | a minus sign with absolute value for ;TI"1 | | negative values. ;TI"I---------+---------------+----------------------------------------- ;TI"G(digit)$ | all | Specifies the absolute argument number ;TI"G | | for this field. Absolute and relative ;TI"F | | argument numbers cannot be mixed in a ;TI"0 | | sprintf string. ;TI"I---------+---------------+----------------------------------------- ;TI"; # | bBoxX | Use an alternative format. ;TI"P | aAeEfgG | For the conversions `o', increase the precision ;TI"E | | until the first digit will be `0' if ;TI"D | | it is not formatted as complements. ;TI"J | | For the conversions `x', `X', `b' and `B' ;TI"L | | on non-zero, prefix the result with ``0x'', ;TI"I | | ``0X'', ``0b'' and ``0B'', respectively. ;TI"K | | For `a', `A', `e', `E', `f', `g', and 'G', ;TI"C | | force a decimal point to be added, ;TI": | | even if no digits follow. ;TI"O | | For `g' and 'G', do not remove trailing zeros. ;TI"I---------+---------------+----------------------------------------- ;TI"H+ | bBdiouxX | Add a leading plus sign to non-negative ;TI") | aAeEfgG | numbers. ;TI"D | (numeric fmt) | For `o', `x', `X', `b' and `B', use ;TI"E | | a minus sign with absolute value for ;TI"1 | | negative values. ;TI"I---------+---------------+----------------------------------------- ;TI"L- | all | Left-justify the result of this conversion. ;TI"I---------+---------------+----------------------------------------- ;TI"<0 (zero) | bBdiouxX | Pad with zeros, not spaces. ;TI"H | aAeEfgG | For `o', `x', `X', `b' and `B', radix-1 ;TI"J | (numeric fmt) | is used for negative numbers formatted as ;TI"- | | complements. ;TI"I---------+---------------+----------------------------------------- ;TI"J* | all | Use the next argument as the field width. ;TI"M | | If negative, left-justify the result. If the ;TI"N | | asterisk is followed by a number and a dollar ;TI"O | | sign, use the indicated argument as the width. ;T; 0o; ; [I"Examples of flags:;T@o; ; [:I"F# `+' and space flag specifies the sign of non-negative numbers. ;TI"#sprintf("%d", 123) #=> "123" ;TI"$sprintf("%+d", 123) #=> "+123" ;TI"$sprintf("% d", 123) #=> " 123" ;TI" ;TI"@# `#' flag for `o' increases number of digits to show `0'. ;TI"># `+' and space flag changes format of negative numbers. ;TI"$sprintf("%o", 123) #=> "173" ;TI"%sprintf("%#o", 123) #=> "0173" ;TI"%sprintf("%+o", -123) #=> "-173" ;TI"'sprintf("%o", -123) #=> "..7605" ;TI"'sprintf("%#o", -123) #=> "..7605" ;TI" ;TI"@# `#' flag for `x' add a prefix `0x' for non-zero numbers. ;TI"E# `+' and space flag disables complements for negative numbers. ;TI"#sprintf("%x", 123) #=> "7b" ;TI"%sprintf("%#x", 123) #=> "0x7b" ;TI"$sprintf("%+x", -123) #=> "-7b" ;TI"&sprintf("%x", -123) #=> "..f85" ;TI"(sprintf("%#x", -123) #=> "0x..f85" ;TI""sprintf("%#x", 0) #=> "0" ;TI" ;TI")# `#' for `X' uses the prefix `0X'. ;TI""sprintf("%X", 123) #=> "7B" ;TI"$sprintf("%#X", 123) #=> "0X7B" ;TI" ;TI"@# `#' flag for `b' add a prefix `0b' for non-zero numbers. ;TI"E# `+' and space flag disables complements for negative numbers. ;TI"(sprintf("%b", 123) #=> "1111011" ;TI"*sprintf("%#b", 123) #=> "0b1111011" ;TI")sprintf("%+b", -123) #=> "-1111011" ;TI"+sprintf("%b", -123) #=> "..10000101" ;TI"-sprintf("%#b", -123) #=> "0b..10000101" ;TI""sprintf("%#b", 0) #=> "0" ;TI" ;TI")# `#' for `B' uses the prefix `0B'. ;TI"'sprintf("%B", 123) #=> "1111011" ;TI")sprintf("%#B", 123) #=> "0B1111011" ;TI" ;TI"5# `#' for `e' forces to show the decimal point. ;TI"%sprintf("%.0e", 1) #=> "1e+00" ;TI"&sprintf("%#.0e", 1) #=> "1.e+00" ;TI" ;TI"5# `#' for `f' forces to show the decimal point. ;TI"'sprintf("%.0f", 1234) #=> "1234" ;TI"(sprintf("%#.0f", 1234) #=> "1234." ;TI" ;TI"5# `#' for `g' forces to show the decimal point. ;TI"0# It also disables stripping lowest zeros. ;TI"(sprintf("%g", 123.4) #=> "123.4" ;TI"*sprintf("%#g", 123.4) #=> "123.400" ;TI")sprintf("%g", 123456) #=> "123456" ;TI"*sprintf("%#g", 123456) #=> "123456." ;T; 0o; ; [I"FThe field width is an optional integer, followed optionally by a ;TI"Hperiod and a precision. The width specifies the minimum number of ;TI"Bcharacters that will be written to the result for this field.;T@o; ; [I"Examples of width:;T@o; ; [I"1# padding is done by spaces, width=20 ;TI"6# 0 or radix-1. <------------------> ;TI"7sprintf("%20d", 123) #=> " 123" ;TI"7sprintf("%+20d", 123) #=> " +123" ;TI"7sprintf("%020d", 123) #=> "00000000000000000123" ;TI"7sprintf("%+020d", 123) #=> "+0000000000000000123" ;TI"7sprintf("% 020d", 123) #=> " 0000000000000000123" ;TI"7sprintf("%-20d", 123) #=> "123 " ;TI"7sprintf("%-+20d", 123) #=> "+123 " ;TI"7sprintf("%- 20d", 123) #=> " 123 " ;TI"7sprintf("%020x", -123) #=> "..ffffffffffffffff85" ;T; 0o; ; [ I" For ;TI"Inumeric fields, the precision controls the number of decimal places ;TI"Idisplayed. For string fields, the precision determines the maximum ;TI"Knumber of characters to be copied from the string. (Thus, the format ;TI"Fsequence %10.10s will always contribute exactly ten ;TI"characters to the result.);T@o; ; [I"Examples of precisions:;T@o; ; [-I".# precision for `d', 'o', 'x' and 'b' is ;TI"7# minimum number of digits <------> ;TI"8sprintf("%20.8d", 123) #=> " 00000123" ;TI"8sprintf("%20.8o", 123) #=> " 00000173" ;TI"8sprintf("%20.8x", 123) #=> " 0000007b" ;TI"8sprintf("%20.8b", 123) #=> " 01111011" ;TI"8sprintf("%20.8d", -123) #=> " -00000123" ;TI"8sprintf("%20.8o", -123) #=> " ..777605" ;TI"8sprintf("%20.8x", -123) #=> " ..ffff85" ;TI"8sprintf("%20.8b", -11) #=> " ..110101" ;TI" ;TI":# "0x" and "0b" for `#x' and `#b' is not counted for ;TI"8# precision but "0" for `#o' is counted. <------> ;TI"9sprintf("%#20.8d", 123) #=> " 00000123" ;TI"9sprintf("%#20.8o", 123) #=> " 00000173" ;TI"9sprintf("%#20.8x", 123) #=> " 0x0000007b" ;TI"9sprintf("%#20.8b", 123) #=> " 0b01111011" ;TI"9sprintf("%#20.8d", -123) #=> " -00000123" ;TI"9sprintf("%#20.8o", -123) #=> " ..777605" ;TI"9sprintf("%#20.8x", -123) #=> " 0x..ffff85" ;TI"9sprintf("%#20.8b", -11) #=> " 0b..110101" ;TI" ;TI"&# precision for `e' is number of ;TI"9# digits after the decimal point <------> ;TI">sprintf("%20.8e", 1234.56789) #=> " 1.23456789e+03" ;TI" ;TI"&# precision for `f' is number of ;TI"=# digits after the decimal point <------> ;TI">sprintf("%20.8f", 1234.56789) #=> " 1234.56789000" ;TI" ;TI"&# precision for `g' is number of ;TI"=# significant digits <-------> ;TI">sprintf("%20.8g", 1234.56789) #=> " 1234.5679" ;TI" ;TI"9# <-------> ;TI">sprintf("%20.8g", 123456789) #=> " 1.2345679e+08" ;TI" ;TI"# precision for `s' is ;TI"@# maximum number of characters <------> ;TI"Asprintf("%20.8s", "string test") #=> " string t" ;T; 0o; ; [I"Examples:;T@o; ; [ I"?sprintf("%d %04x", 123, 123) #=> "123 007b" ;TI"Fsprintf("%08b '%4s'", 123, 123) #=> "01111011 ' 123'" ;TI"Gsprintf("%1$*2$s %2$d %1$s", "hello", 8) #=> " hello 8 hello" ;TI"Bsprintf("%1$*2$s %2$d", "hello", -8) #=> "hello -8" ;TI"Gsprintf("%+g:% g:%-g", 1.23, 1.23, 1.23) #=> "+1.23: 1.23:1.23" ;TI";sprintf("%u", -123) #=> "-123" ;T; 0o; ; [I"EFor more complex formatting, Ruby supports a reference by name. ;TI"A%s style uses format style, but %{name} style doesn't.;T@o; ; [I"Examples:;To; ; [ I"d : %f", { :foo => 1, :bar => 2 }) ;TI" #=> 1 : 2.000000 ;TI"'sprintf("%{foo}f", { :foo => 1 }) ;TI" # => "1f";T; 0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI" Kernel;TcRDoc::NormalModule0[@FI" sprintf;TPK]O1 eval-i.rinu[U:RDoc::AnyMethod[iI" eval:ETI"Kernel#eval;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"=Evaluates the Ruby expression(s) in string. If ;TI"Dbinding is given, which must be a Binding object, the ;TI"=evaluation is performed in its context. If the optional ;TI"Hfilename and lineno parameters are present, they ;TI"/will be used when reporting syntax errors.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"def get_binding(str) ;TI" return binding ;TI" end ;TI"str = "hello" ;TI"@eval "str + ' Fred'" #=> "hello Fred" ;TI"=eval "str + ' Fred'", get_binding("bye") #=> "bye Fred";T: @format0: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"=eval(string [, binding [, filename [,lineno]]]) -> obj ;T0[I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@FI" Kernel;TcRDoc::NormalModule00PK]' readline-i.rinu[U:RDoc::AnyMethod[iI" readline:ETI"Kernel#readline;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Equivalent to Kernel::gets, except ;TI"1+readline+ raises +EOFError+ at end of file.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"breadline(sep=$/) -> string readline(limit) -> string readline(sep, limit) -> string ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]55 system-i.rinu[U:RDoc::AnyMethod[iI" system:ETI"Kernel#system;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"*Executes _command..._ in a subshell. ;TI",_command..._ is one of following forms.;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: LABEL: @items[o:RDoc::Markup::ListItem: @label[I"commandline;T; [o; ; [I">command line string which is passed to the standard shell;To;;[I"$cmdname, arg1, ...;T; [o; ; [I"6command name and one or more arguments (no shell);To;;[I"-[cmdname, argv0], arg1, ...;T; [o; ; [I"Mcommand name, argv[0] and zero or more arguments (no shell);T@o; ; [ I"Bsystem returns +true+ if the command gives zero exit status, ;TI"'+false+ for non zero exit status. ;TI"/Returns +nil+ if command execution fails. ;TI"5An error status is available in $?.;T@o; ; [I"HIf the exception: true argument is passed, the method ;TI"?raises an exception instead of returning +false+ or +nil+.;T@o; ; [I"4The arguments are processed in the same way as ;TI"for Kernel#spawn.;T@o; ; [I"HThe hash arguments, env and options, are same as #exec and #spawn. ;TI""See Kernel#spawn for details.;T@o:RDoc::Markup::Verbatim; [I"system("echo *") ;TI"system("echo", "*") ;T: @format0o; ; [I"produces:;T@o;; [I"config.h main.rb ;TI"* ;T;0o; ; [I"Error handling:;T@o;; [I"#system("cat nonexistent.txt") ;TI"# => false ;TI"$system("catt nonexistent.txt") ;TI"# => nil ;TI" ;TI"4system("cat nonexistent.txt", exception: true) ;TI"6# RuntimeError (Command failed with exit 1: cat) ;TI"5system("catt nonexistent.txt", exception: true) ;TI"8# Errno::ENOENT (No such file or directory - catt) ;T;0o; ; [I",See Kernel#exec for the standard shell.;T: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"Usystem([env,] command... [,options], exception: false) -> true, false or nil ;T0[I" (*args);T@UFI" Kernel;TcRDoc::NormalModule00PK]+== warn-i.rinu[U:RDoc::AnyMethod[iI" warn:ETI"Kernel#warn;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I":If warnings have been disabled (for example with the ;TI"7-W0 flag), does nothing. Otherwise, ;TI"Aconverts each of the messages to strings, appends a newline ;TI"Fcharacter to the string if the string does not end in a newline, ;TI",and calls Warning.warn with the string.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"& warn("warning 1", "warning 2") ;TI" ;TI"produces: ;TI" ;TI" warning 1 ;TI" warning 2 ;T: @format0o; ; [I"LIf the uplevel keyword argument is given, the string will ;TI"Abe prepended with information for the given caller frame in ;TI"Athe same format used by the rb_warn C function.;T@o; ; [I" # In baz.rb ;TI" def foo ;TI"1 warn("invalid call to foo", uplevel: 1) ;TI" end ;TI" ;TI" def bar ;TI" foo ;TI" end ;TI" ;TI" bar ;TI" ;TI"produces: ;TI" ;TI". baz.rb:6: warning: invalid call to foo ;T; 0o; ; [I"MIf category keyword argument is given, passes the category ;TI"Mto Warning.warn. The category given must be be one of the ;TI"following categories:;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I":deprecated ;T; [o; ; [I" nil ;T0[I")(*msgs, uplevel: nil, category: nil);T@GFI" Kernel;TcRDoc::NormalModule00PK]/m print-i.rinu[U:RDoc::AnyMethod[iI" print:ETI"Kernel#print;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"GPrints each object in turn to $stdout. If the output ;TI"9field separator ($,) is not +nil+, its ;TI"Ccontents will appear between each field. If the output record ;TI";separator ($\\) is not +nil+, it will be ;TI"?appended to the output. If no arguments are given, prints ;TI"G$_. Objects that aren't strings will be converted by ;TI",calling their to_s method.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"$print "cat", [1,2,3], 99, "\n" ;TI"$, = ", " ;TI"$\ = "\n" ;TI"print "cat", [1,2,3], 99 ;T: @format0o; ; [I"produces:;T@o; ; [I"cat12399 ;TI"cat, 1, 2, 3, 99;T; 0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"print(obj, ...) -> nil ;T0[I" (*args);T@"FI" Kernel;TcRDoc::NormalModule00PK]D   caller-i.rinu[U:RDoc::AnyMethod[iI" caller:ETI"Kernel#caller;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"JReturns the current execution stack---an array containing strings in ;TI"file:line or file:line: in ;TI"`method'.;To:RDoc::Markup::BlankLineo; ; [I"KThe optional _start_ parameter determines the number of initial stack ;TI"/entries to omit from the top of the stack.;T@o; ; [I"PA second optional +length+ parameter can be used to limit how many entries ;TI"!are returned from the stack.;T@o; ; [I":Returns +nil+ if _start_ is greater than the size of ;TI"current execution stack.;T@o; ; [I"POptionally you can pass a range, which will return an array containing the ;TI"(entries within the specified range.;T@o:RDoc::Markup::Verbatim; [I"def a(skip) ;TI" caller(skip) ;TI" end ;TI"def b(skip) ;TI" a(skip) ;TI" end ;TI"def c(skip) ;TI" b(skip) ;TI" end ;TI"[c(0) #=> ["prog:2:in `a'", "prog:5:in `b'", "prog:8:in `c'", "prog:10:in `
'"] ;TI"Jc(1) #=> ["prog:5:in `b'", "prog:8:in `c'", "prog:11:in `
'"] ;TI"9c(2) #=> ["prog:8:in `c'", "prog:12:in `
'"] ;TI"(c(3) #=> ["prog:13:in `
'"] ;TI"c(4) #=> [] ;TI"c(5) #=> nil;T: @format0: @fileI"vm_backtrace.c;T:0@omit_headings_from_table_of_contents_below0I"_caller(start=1, length=nil) -> array or nil caller(range) -> array or nil ;T0[I" (*args);T@2FI" Kernel;TcRDoc::NormalModule00PK]֢doo throw-i.rinu[U:RDoc::AnyMethod[iI" throw:ETI"Kernel#throw;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I">Transfers control to the end of the active +catch+ block ;TI"=waiting for _tag_. Raises +UncaughtThrowError+ if there ;TI"parameter supplies a return value for the +catch+ block, ;TI":which otherwise defaults to +nil+. For examples, see ;TI"Kernel::catch.;T: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"throw(tag [, obj]) ;T0[I"(p1, p2 = v2);T@FI" Kernel;TcRDoc::NormalModule00PK] ٕ fail-i.rinu[U:RDoc::AnyMethod[iI" fail:ETI"Kernel#fail;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JWith no arguments, raises the exception in $! or raises ;TI"Ia RuntimeError if $! is +nil+. With a single +String+ ;TI"Pargument, raises a +RuntimeError+ with the string as a message. Otherwise, ;TI"Dthe first parameter should be an +Exception+ class (or another ;TI"Hobject that returns an +Exception+ object when sent an +exception+ ;TI"Omessage). The optional second parameter sets the message associated with ;TI"Othe exception (accessible via Exception#message), and the third parameter ;TI"Ois an array of callback information (accessible via Exception#backtrace). ;TI"MThe +cause+ of the generated exception (accessible via Exception#cause) ;TI"Pis automatically set to the "current" exception ($!), if any. ;TI"IAn alternative value, either an +Exception+ object or +nil+, can be ;TI")specified via the +:cause+ argument.;To:RDoc::Markup::BlankLineo; ; [I"5Exceptions are caught by the +rescue+ clause of ;TI"%begin...end blocks.;T@o:RDoc::Markup::Verbatim; [I"%raise "Failed to create socket" ;TI"1raise ArgumentError, "No parameters", caller;T: @format0: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@"FI" Kernel;TcRDoc::NormalModule0[@%FI" raise;TPK]˫ѧ loop-i.rinu[U:RDoc::AnyMethod[iI" loop:ETI"Kernel#loop;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"#Repeatedly executes the block.;To:RDoc::Markup::BlankLineo; ; [I"=If no block is given, an enumerator is returned instead.;T@o:RDoc::Markup::Verbatim; [ I" loop do ;TI" print "Input: " ;TI" line = gets ;TI"' break if !line or line =~ /^qQ/ ;TI" # ... ;TI" end ;T: @format0o; ; [I"GStopIteration raised in the block breaks the loop. In this case, ;TI"=loop returns the "result" value stored in the exception.;T@o; ; [I"!enum = Enumerator.new { |y| ;TI" y << "one" ;TI" y << "two" ;TI" :ok ;TI"} ;TI" ;TI"result = loop { ;TI" puts enum.next ;TI"} #=> :ok;T; 0: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"5loop { block } loop -> an_enumerator ;T0[I"();T@)FI" Kernel;TcRDoc::NormalModule00PK]Rxx Float-i.rinu[U:RDoc::AnyMethod[iI" Float:ETI"Kernel#Float;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"@Returns arg converted to a float. Numeric types are ;TI":converted directly, and with exception to String and ;TI"3nil the rest are converted using ;TI"Earg.to_f. Converting a String with invalid ;TI"nil generates a TypeError. Exceptions can be ;TI"9suppressed by passing exception: false.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"&Float(1) #=> 1.0 ;TI"*Float("123.456") #=> 123.456 ;TI"^Float("123.0_badstring") #=> ArgumentError: invalid value for Float(): "123.0_badstring" ;TI"JFloat(nil) #=> TypeError: can't convert nil into Float ;TI"8Float("123.0_badstring", exception: false) #=> nil;T: @format0: @fileI"kernel.rb;T:0@omit_headings_from_table_of_contents_below0I"4Float(arg, exception: true) -> float or nil ;T0[I"(arg, exception: true);T@FI" Kernel;TcRDoc::NormalModule00PK]F chop-i.rinu[U:RDoc::AnyMethod[iI" chop:ETI"Kernel#chop;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HEquivalent to ($_.dup).chop!, except nil ;TI"*is never returned. See String#chop!. ;TI"=Available only when -p/-n command line option specified.;T: @fileI" ruby.c;T:0@omit_headings_from_table_of_contents_below0I"chop -> $_ ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]Yvl55URI-c.rinu[U:RDoc::AnyMethod[iI"URI:ETI"Kernel::URI;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Returns +uri+ converted to an URI object.;T: @fileI"lib/uri/common.rb;T:0@omit_headings_from_table_of_contents_below000[I" (uri);T@FI" Kernel;TcRDoc::NormalModule00PK]Qe*44URI-i.rinu[U:RDoc::AnyMethod[iI"URI:ETI"Kernel#URI;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Returns +uri+ converted to an URI object.;T: @fileI"lib/uri/common.rb;T:0@omit_headings_from_table_of_contents_below000[I" (uri);T@FI" Kernel;TcRDoc::NormalModule00PK]8b puts-i.rinu[U:RDoc::AnyMethod[iI" puts:ETI"Kernel#puts;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Equivalent to;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"$stdout.puts(obj, ...);T: @format0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"puts(obj, ...) -> nil ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]/UV..gem_original_require-i.rinu[U:RDoc::AnyMethod[iI"gem_original_require:ETI" Kernel#gem_original_require;TF: privateo:RDoc::Markup::Document: @parts[: @fileI",lib/rubygems/core_ext/kernel_require.rb;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Kernel;TcRDoc::NormalModule0[@FI" require;TPK]jǥ*  yield_self-i.rinu[U:RDoc::AnyMethod[iI"yield_self:ETI"Kernel#yield_self;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"BYields self to the block and returns the result of the block.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I">"my string".yield_self {|s| s.upcase } #=> "MY STRING" ;T: @format0o; ; [I" an_object ;TI" self;T[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]pgg callcc-i.rinu[U:RDoc::AnyMethod[iI" callcc:ETI"Kernel#callcc;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"9Generates a Continuation object, which it passes to ;TI"5the associated block. You need to require ;TI"B'continuation' before using this method. Performing a ;TI"<cont.call will cause the #callcc ;TI"Cto return (as will falling through the end of the block). The ;TI"7value returned by the #callcc is the value of the ;TI"Hblock, or the value passed to cont.call. See ;TI"3class Continuation for more details. Also see ;TI"3Kernel#throw for an alternative mechanism for ;TI"unwinding a call stack.;T: @fileI" cont.c;T:0@omit_headings_from_table_of_contents_below0I"&callcc {|cont| block } -> obj ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]IIIcaller_locations-i.rinu[U:RDoc::AnyMethod[iI"caller_locations:ETI"Kernel#caller_locations;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?Returns the current execution stack---an array containing ;TI" backtrace location objects.;To:RDoc::Markup::BlankLineo; ; [I":See Thread::Backtrace::Location for more information.;T@o; ; [I"KThe optional _start_ parameter determines the number of initial stack ;TI"/entries to omit from the top of the stack.;T@o; ; [I"PA second optional +length+ parameter can be used to limit how many entries ;TI"!are returned from the stack.;T@o; ; [I":Returns +nil+ if _start_ is greater than the size of ;TI"current execution stack.;T@o; ; [I"POptionally you can pass a range, which will return an array containing the ;TI"(entries within the specified range.;T: @fileI"vm_backtrace.c;T:0@omit_headings_from_table_of_contents_below0I"wcaller_locations(start=1, length=nil) -> array or nil caller_locations(range) -> array or nil ;T0[I" (*args);T@#FI" Kernel;TcRDoc::NormalModule00PK]lVBB at_exit-i.rinu[U:RDoc::AnyMethod[iI" at_exit:ETI"Kernel#at_exit;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"8Converts _block_ to a +Proc+ object (and therefore ;TI"Hbinds it at the point of call) and registers it for execution when ;TI"Fthe program exits. If multiple handlers are registered, they are ;TI"/executed in reverse order of registration.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"def do_at_exit(str1) ;TI" at_exit { print str1 } ;TI" end ;TI"$at_exit { puts "cruel world" } ;TI"do_at_exit("goodbye ") ;TI" exit ;T: @format0o; ; [I"produces:;T@o; ; [I"goodbye cruel world;T; 0: @fileI"eval_jump.c;T:0@omit_headings_from_table_of_contents_below0I"at_exit { block } -> proc ;T0[I"();T@ FI" Kernel;TcRDoc::NormalModule00PK]|global_variables-i.rinu[U:RDoc::AnyMethod[iI"global_variables:ETI"Kernel#global_variables;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"FReturns an array of the names of global variables. This includes ;TI"Jspecial regexp global variables such as $~ and $+, ;TI"Mbut does not include the numbered regexp global variables ($1, ;TI"$2, etc.).;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"Dglobal_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr];T: @format0: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below0I""global_variables -> array ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK],Z Array-i.rinu[U:RDoc::AnyMethod[iI" Array:ETI"Kernel#Array;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Returns +arg+ as an Array.;To:RDoc::Markup::BlankLineo; ; [I"OFirst tries to call to_ary on +arg+, then to_a. ;TI"LIf +arg+ does not respond to to_ary or to_a, ;TI"3returns an Array of length 1 containing +arg+.;T@o; ; [I"NIf to_ary or to_a returns something other than ;TI""an Array, raises a TypeError.;T@o:RDoc::Markup::Verbatim; [ I"'Array(["a", "b"]) #=> ["a", "b"] ;TI",Array(1..5) #=> [1, 2, 3, 4, 5] ;TI"-Array(key: :value) #=> [[:key, :value]] ;TI"Array(nil) #=> [] ;TI"Array(1) #=> [1];T: @format0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"Array(arg) -> array ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00PK]2 exit%21-i.rinu[U:RDoc::AnyMethod[iI" exit!:ETI"Kernel#exit!;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"9Exits the process immediately. No exit handlers are ;TI"Frun. status is returned to the underlying system as the ;TI"exit status.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"Process.exit!(true);T: @format0: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"!Process.exit!(status=false) ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]'%%60-i.rinu[U:RDoc::AnyMethod[iI"`:ETI" Kernel#`;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"AReturns the standard output of running _cmd_ in a subshell. ;TI"3The built-in syntax %x{...} uses ;TI"=this method. Sets $? to the process status.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"C`date` #=> "Wed Apr 9 08:56:30 CDT 2003\n" ;TI",`ls testdir`.split[1] #=> "main.rb" ;TI"+`echo oops && exit 99` #=> "oops\n" ;TI"$$?.exitstatus #=> 99;T: @format0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"`cmd` -> string ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00PK]  set_trace_func-i.rinu[U:RDoc::AnyMethod[iI"set_trace_func:ETI"Kernel#set_trace_func;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Verbatim; [9I"@Establishes _proc_ as the handler for tracing, or disables ;TI"(tracing if the parameter is +nil+. ;TI" ;TI"E*Note:* this method is obsolete, please use TracePoint instead. ;TI" ;TI"(_proc_ takes up to six parameters: ;TI" ;TI"* an event name ;TI"* a filename ;TI"* a line number ;TI"* an object id ;TI"* a binding ;TI"* the name of a class ;TI" ;TI"1_proc_ is invoked whenever an event occurs. ;TI" ;TI"Events are: ;TI" ;TI"*+c-call+:: call a C-language routine ;TI"3+c-return+:: return from a C-language routine ;TI"!+call+:: call a Ruby method ;TI"2+class+:: start a class or module definition ;TI"1+end+:: finish a class or module definition ;TI")+line+:: execute code on a new line ;TI""+raise+:: raise an exception ;TI"*+return+:: return from a Ruby method ;TI" ;TI"7Tracing is disabled within the context of _proc_. ;TI" ;TI" class Test ;TI" def test ;TI" a = 1 ;TI" b = 2 ;TI" end ;TI" end ;TI" ;TI"K set_trace_func proc { |event, file, line, id, binding, classname| ;TI"N printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname ;TI" } ;TI" t = Test.new ;TI" t.test ;TI" ;TI"/ line prog.rb:11 false ;TI"/ c-call prog.rb:11 new Class ;TI"/ c-call prog.rb:11 initialize Object ;TI"/ c-return prog.rb:11 initialize Object ;TI"/ c-return prog.rb:11 new Class ;TI"/ line prog.rb:12 false ;TI"/ call prog.rb:2 test Test ;TI"/ line prog.rb:3 test Test ;TI"/ line prog.rb:4 test Test ;TI"/ return prog.rb:4 test Test ;T: @format0o:RDoc::Markup::Paragraph; [I"ONote that for +c-call+ and +c-return+ events, the binding returned is the ;TI"Nbinding of the nearest Ruby method calling the C method, since C methods ;TI"%themselves do not have bindings.;T: @fileI"vm_trace.c;T:0@omit_headings_from_table_of_contents_below0I"Dset_trace_func(proc) -> proc set_trace_func(nil) -> nil ;T0[I" (p1);T@FFI" Kernel;TcRDoc::NormalModule00PK],Zww Complex-i.rinu[U:RDoc::AnyMethod[iI" Complex:ETI"Kernel#Complex;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Returns x+i*y;;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"!Complex(1, 2) #=> (1+2i) ;TI"!Complex('1+2i') #=> (1+2i) ;TI"$Complex(nil) #=> TypeError ;TI"$Complex(1, nil) #=> TypeError ;TI" ;TI"0Complex(1, nil, exception: false) #=> nil ;TI"0Complex('1+2', exception: false) #=> nil ;T: @format0o; ; [I"Syntax of string form:;T@o; ; [I";string form = extra spaces , complex , extra spaces ; ;TI"5complex = real part | [ sign ] , imaginary part ;TI"1 | real part , sign , imaginary part ;TI"+ | rational , "@" , rational ; ;TI"real part = rational ; ;TI"Limaginary part = imaginary unit | unsigned rational , imaginary unit ; ;TI"/rational = [ sign ] , unsigned rational ; ;TI"Eunsigned rational = numerator | numerator , "/" , denominator ; ;TI"Snumerator = integer part | fractional part | integer part , fractional part ; ;TI"denominator = digits ; ;TI"integer part = digits ; ;TI"Nfractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ; ;TI".imaginary unit = "i" | "I" | "j" | "J" ; ;TI"sign = "-" | "+" ; ;TI"/digits = digit , { digit | "_" , digit }; ;TI"Idigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; ;TI"extra spaces = ? \s* ? ; ;T; 0o; ; [I"See String#to_c.;T: @fileI"complex.c;T:0@omit_headings_from_table_of_contents_below0I":Complex(x[, y], exception: true) -> numeric or nil ;T0[I"(p1, p2 = v2, p3 = {});T@1FI" Kernel;TcRDoc::NormalModule00PK])Z XXiterator%3f-i.rinu[U:RDoc::AnyMethod[iI"iterator?:ETI"Kernel#iterator?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"+Deprecated. Use block_given? instead.;T: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"%iterator? -> true or false ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]} putc-i.rinu[U:RDoc::AnyMethod[iI" putc:ETI"Kernel#putc;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Equivalent to:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"$stdout.putc(int) ;T: @format0o; ; [I"PRefer to the documentation for IO#putc for important information regarding ;TI"multi-byte characters.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"putc(int) -> int ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00PK]\0 0 BigDecimal-i.rinu[U:RDoc::AnyMethod[iI"BigDecimal:ETI"Kernel#BigDecimal;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Verbatim; [ I"4Returns the \BigDecimal converted from +value+ ;TI"3with a precision of +ndigits+ decimal digits. ;TI" ;TI"BWhen +ndigits+ is less than the number of significant digits ;TI"Cin the value, the result is rounded to that number of digits, ;TI"Baccording to the current rounding mode; see BigDecimal.mode. ;T: @format0o:RDoc::Markup::Paragraph; [I"RReturns +value+ converted to a \BigDecimal, depending on the type of +value+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0; [o; ; [I"JInteger, Float, Rational, Complex, or BigDecimal: converted directly:;T@o; ; [ I"Y# Integer, Complex, or BigDecimal value does not require ndigits; ignored if given. ;TI"2BigDecimal(2) # => 0.2e1 ;TI"2BigDecimal(Complex(2, 0)) # => 0.2e1 ;TI"2BigDecimal(BigDecimal(2)) # => 0.2e1 ;TI"1# Float or Rational value requires ndigits. ;TI"2BigDecimal(2.0, 0) # => 0.2e1 ;TI"2BigDecimal(Rational(2, 1), 0) # => 0.2e1 ;T; 0o;;0; [o; ; [I"WString: converted by parsing if it contains an integer or floating-point literal; ;TI"0leading and trailing whitespace is ignored:;T@o; ; [ I":# String does not require ndigits; ignored if given. ;TI"$BigDecimal('2') # => 0.2e1 ;TI"$BigDecimal('2.0') # => 0.2e1 ;TI"$BigDecimal('0.2e1') # => 0.2e1 ;TI"$BigDecimal(' 2.0 ') # => 0.2e1 ;T; 0o;;0; [o; ; [I":Other type that responds to method :to_str: ;TI"Lfirst converted to a string, then converted to a \BigDecimal, as above.;T@o;;0; [o; ; [I"Other type:;T@o;;;;[o;;0; [o; ; [I"CRaises an exception if keyword argument +exception+ is +true+.;To;;0; [o; ; [I"=Returns +nil+ if keyword argument +exception+ is +true+.;T@o; ; [I"9Raises an exception if +value+ evaluates to a Float ;TI"0and +digits+ is larger than Float::DIG + 1.;T: @fileI" ext/bigdecimal/bigdecimal.c;T:0@omit_headings_from_table_of_contents_below0I"pBigDecimal(value, exception: true) -> bigdecimal BigDecimal(value, ndigits, exception: true) -> bigdecimal ;T0[I"(p1, p2 = v2, p3 = {});T@OFI" Kernel;TcRDoc::NormalModule00PK][gDD srand-i.rinu[U:RDoc::AnyMethod[iI" srand:ETI"Kernel#srand;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ESeeds the system pseudo-random number generator, with +number+. ;TI")The previous seed value is returned.;To:RDoc::Markup::BlankLineo; ; [ I"KIf +number+ is omitted, seeds the generator using a source of entropy ;TI"Rprovided by the operating system, if available (/dev/urandom on Unix systems ;TI"Por the RSA cryptographic provider on Windows), which is then combined with ;TI"5the time, the process id, and a sequence number.;T@o; ; [I"Osrand may be used to ensure repeatable sequences of pseudo-random numbers ;TI"Rbetween different runs of the program. By setting the seed to a known value, ;TI"7programs can be made deterministic during testing.;T@o:RDoc::Markup::Verbatim; [ I"Ksrand 1234 # => 268519324636777531569100071560086917274 ;TI"L[ rand, rand ] # => [0.1915194503788923, 0.6221087710398319] ;TI",[ rand(10), rand(1000) ] # => [4, 664] ;TI"(srand 1234 # => 1234 ;TI"K[ rand, rand ] # => [0.1915194503788923, 0.6221087710398319];T: @format0: @fileI" random.c;T:0@omit_headings_from_table_of_contents_below0I"1srand(number = Random.new_seed) -> old_seed ;T0[I" (*args);T@"FI" Kernel;TcRDoc::NormalModule00PK]`p-i.rinu[U:RDoc::AnyMethod[iI"p:ETI" Kernel#p;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"DFor each object, directly writes _obj_.+inspect+ followed by a ;TI".newline to the program's standard output.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"#S = Struct.new(:name, :state) ;TI"s = S['dave', 'TX'] ;TI" p s ;T: @format0o; ; [I"produces:;T@o; ; [I"!#;T; 0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"]p(obj) -> obj p(obj1, obj2, ...) -> [obj, ...] p() -> nil ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]\# lambda-i.rinu[U:RDoc::AnyMethod[iI" lambda:ETI"Kernel#lambda;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"IEquivalent to Proc.new, except the resulting Proc objects check the ;TI"-number of parameters passed when called.;T: @fileI" proc.c;T:0@omit_headings_from_table_of_contents_below0I"'lambda { |...| block } -> a_proc ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]fll select-i.rinu[U:RDoc::AnyMethod[iI" select:ETI"Kernel#select;TF: privateo:RDoc::Markup::Document: @parts[-o:RDoc::Markup::Paragraph; [ I""Calls select(2) system call. ;TI"HIt monitors given arrays of IO objects, waits until one or more of ;TI"GIO objects are ready for reading, are ready for writing, and have ;TI"Ipending exceptions respectively, and returns an array that contains ;TI"Carrays of those IO objects. It will return +nil+ if optional ;TI"@timeout value is given and no IO object is ready in ;TI"timeout seconds.;To:RDoc::Markup::BlankLineo; ; [ I"GIO.select peeks the buffer of IO objects for testing readability. ;TI"CIf the IO buffer is not empty, IO.select immediately notifies ;TI"Ireadability. This "peek" only happens for IO objects. It does not ;TI"@happen for IO-like objects such as OpenSSL::SSL::SSLSocket.;T@o; ; [ I"DThe best way to use IO.select is invoking it after nonblocking ;TI"Hmethods such as #read_nonblock, #write_nonblock, etc. The methods ;TI"Araise an exception which is extended by IO::WaitReadable or ;TI"FIO::WaitWritable. The modules notify how the caller should wait ;TI"Gwith IO.select. If IO::WaitReadable is raised, the caller should ;TI"Iwait for reading. If IO::WaitWritable is raised, the caller should ;TI"wait for writing.;T@o; ; [I"IO#write(two or more bytes) can block after ;TI"Jwritability is notified by IO.select. IO#write_nonblock is required ;TI"to avoid the blocking.;T@o; ; [I"GBlocking write (#write) can be emulated using #write_nonblock and ;TI"GIO.select as follows: IO::WaitReadable should also be rescued for ;TI"2SSL renegotiation in OpenSSL::SSL::SSLSocket.;T@o; ; [I"while 0 < string.bytesize ;TI" begin ;TI"2 written = io_like.write_nonblock(string) ;TI" rescue IO::WaitReadable ;TI" IO.select([io_like]) ;TI" retry ;TI" rescue IO::WaitWritable ;TI"# IO.select(nil, [io_like]) ;TI" retry ;TI" end ;TI". string = string.byteslice(written..-1) ;TI" end ;T; 0S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I"read_array;T; [o; ; [I":an array of IO objects that wait until ready for read;To;;[I"write_array;T; [o; ; [I";an array of IO objects that wait until ready for write;To;;[I"error_array;T; [o; ; [I"4an array of IO objects that wait for exceptions;To;;[I" timeout;T; [o; ; [I"a numeric value in second;T@S;;i;I" Example;T@o; ; [I"rp, wp = IO.pipe ;TI"mesg = "ping " ;TI"100.times { ;TI"H # IO.select follows IO#read. Not the best way to use IO.select. ;TI"' rs, ws, = IO.select([rp], [wp]) ;TI" if r = rs[0] ;TI" ret = r.read(5) ;TI" print ret ;TI" case ret ;TI" when /ping/ ;TI" mesg = "pong\n" ;TI" when /pong/ ;TI" mesg = "ping " ;TI" end ;TI" end ;TI" if w = ws[0] ;TI" w.write(mesg) ;TI" end ;TI"} ;T; 0o; ; [I"produces:;T@o; ; [ I"ping pong ;TI"ping pong ;TI"ping pong ;TI"(snipped) ;TI" ping;T; 0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"WIO.select(read_array [, write_array [, error_array [, timeout]]]) -> array or nil ;T0[I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@FI" Kernel;TcRDoc::NormalModule00PK]cc String-i.rinu[U:RDoc::AnyMethod[iI" String:ETI"Kernel#String;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"$Returns arg as a String.;To:RDoc::Markup::BlankLineo; ; [I"[First tries to call its to_str method, then its to_s method.;T@o:RDoc::Markup::Verbatim; [I"$String(self) #=> "main" ;TI"&String(self.class) #=> "Object" ;TI"%String(123456) #=> "123456";T: @format0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"String(arg) -> string ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00PK]5"  block_given%3f-i.rinu[U:RDoc::AnyMethod[iI"block_given?:ETI"Kernel#block_given?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EReturns true if yield would execute a ;TI"Cblock in the current context. The iterator? form ;TI"is mildly deprecated.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I" def try ;TI" if block_given? ;TI" yield ;TI" else ;TI" "no block" ;TI" end ;TI" end ;TI")try #=> "no block" ;TI"&try { "hello" } #=> "hello" ;TI"%try do "hello" end #=> "hello";T: @format0: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"%block_given? -> true or false ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]sS binding-i.rinu[U:RDoc::AnyMethod[iI" binding:ETI"Kernel#binding;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"=Returns a +Binding+ object, describing the variable and ;TI"Hmethod bindings at the point of call. This object can be used when ;TI"=calling +eval+ to execute the evaluated command in this ;TI">environment. See also the description of class +Binding+.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"def get_binding(param) ;TI" binding ;TI" end ;TI"b = get_binding("hello") ;TI"#eval("param", b) #=> "hello";T: @format0: @fileI" proc.c;T:0@omit_headings_from_table_of_contents_below0I"binding -> a_binding ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]0LAfrozen%3f-i.rinu[U:RDoc::AnyMethod[iI" frozen?:ETI"Kernel#frozen?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"-Returns the freeze status of obj.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"a = [ "a", "b", "c" ] ;TI"%a.freeze #=> ["a", "b", "c"] ;TI"a.frozen? #=> true;T: @format0: @fileI"kernel.rb;T:0@omit_headings_from_table_of_contents_below0I"%obj.frozen? -> true or false ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]ُb Pathname-i.rinu[U:RDoc::AnyMethod[iI" Pathname:ETI"Kernel#Pathname;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NCreates a new Pathname object from the given string, +path+, and returns ;TI"pathname object.;To:RDoc::Markup::BlankLineo; ; [I"KIn order to use this constructor, you must first require the Pathname ;TI" standard library extension.;T@o:RDoc::Markup::Verbatim; [I"require 'pathname' ;TI"Pathname("/home/zzak") ;TI" #=> # ;T: @format0o; ; [I"1See also Pathname::new for more information.;T: @fileI"ext/pathname/pathname.c;T:0@omit_headings_from_table_of_contents_below0I"!Pathname(path) -> pathname ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00PK]   printf-i.rinu[U:RDoc::AnyMethod[iI" printf:ETI"Kernel#printf;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Equivalent to:;To:RDoc::Markup::Verbatim; [I")io.write(sprintf(string, obj, ...)) ;T: @format0o; ; [I"or;To; ; [I"-$stdout.write(sprintf(string, obj, ...));T; 0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"Yprintf(io, string [, obj ... ]) -> nil printf(string [, obj ... ]) -> nil ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]K chomp-i.rinu[U:RDoc::AnyMethod[iI" chomp:ETI"Kernel#chomp;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DEquivalent to $_ = $_.chomp(string). See ;TI"String#chomp. ;TI"=Available only when -p/-n command line option specified.;T: @fileI" ruby.c;T:0@omit_headings_from_table_of_contents_below0I"3chomp -> $_ chomp(string) -> $_ ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]ݴiautoload%3f-i.rinu[U:RDoc::AnyMethod[iI"autoload?:ETI"Kernel#autoload?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@Returns _filename_ to be loaded if _name_ is registered as ;TI"+autoload+.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"autoload(:B, "b") ;TI"%autoload?(:B) #=> "b";T: @format0: @fileI" load.c;T:0@omit_headings_from_table_of_contents_below0I"6autoload?(name, inherit=true) -> String or nil ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]Ϙ]local_variables-i.rinu[U:RDoc::AnyMethod[iI"local_variables:ETI"Kernel#local_variables;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"6Returns the names of the current local variables.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"fred = 1 ;TI"for i in 1..10 ;TI" # ... ;TI" end ;TI"&local_variables #=> [:fred, :i];T: @format0: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"!local_variables -> array ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]LU abort-i.rinu[U:RDoc::AnyMethod[iI" abort:ETI"Kernel#abort;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"=Terminate execution immediately, effectively by calling ;TI"GKernel.exit(false). If _msg_ is given, it is written ;TI"$to STDERR prior to terminating.;T: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"5abort Kernel::abort([msg]) Process.abort([msg]) ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]VäLLy-i.rinu[U:RDoc::AnyMethod[iI"y:ETI" Kernel#y;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">An alias for Psych.dump_stream meant to be used with IRB.;T: @fileI"ext/psych/lib/psych/y.rb;T:0@omit_headings_from_table_of_contents_below000[I"(*objects);T@FI" Kernel;TcRDoc::NormalModule00PK]b`` Integer-i.rinu[U:RDoc::AnyMethod[iI" Integer:ETI"Kernel#Integer;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"(Converts arg to an Integer. ;TI"GNumeric types are converted directly (with floating point numbers ;TI"Kbeing truncated). base (0, or between 2 and 36) is a base for ;TI"@integer string representation. If arg is a String, ;TI"Bwhen base is omitted or equals zero, radix indicators ;TI"I(0, 0b, and 0x) are honored. ;TI"LIn any case, strings should consist only of one or more digits, except ;TI"Nfor that a sign, one underscore between two digits, and leading/trailing ;TI"Cspaces are optional. This behavior is different from that of ;TI"@String#to_i. Non string values will be converted by first ;TI"8trying to_int, then to_i.;To:RDoc::Markup::BlankLineo; ; [ I"NPassing nil raises a TypeError, while passing a String that ;TI"Kdoes not conform with numeric representation raises an ArgumentError. ;TI"LThis behavior can be altered by passing exception: false, ;TI"Gin this case a not convertible value will return nil.;T@o:RDoc::Markup::Verbatim; [I"!Integer(123.999) #=> 123 ;TI" Integer("0x1a") #=> 26 ;TI"(Integer(Time.new) #=> 1204973019 ;TI"!Integer("0930", 10) #=> 930 ;TI"Integer("111", 2) #=> 7 ;TI" Integer(" +1_0 ") #=> 10 ;TI"GInteger(nil) #=> TypeError: can't convert nil into Integer ;TI"MInteger("x") #=> ArgumentError: invalid value for Integer(): "x" ;TI" ;TI"2Integer("x", exception: false) #=> nil;T: @format0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"@Integer(arg, base=0, exception: true) -> integer or nil ;T0[I" (*args);T@+FI" Kernel;TcRDoc::NormalModule00PK]3[͜22 spawn-i.rinu[U:RDoc::AnyMethod[iI" spawn:ETI"Kernel#spawn;TF: privateo:RDoc::Markup::Document: @parts[^o:RDoc::Markup::Paragraph; [I"9spawn executes specified command and return its pid.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"3pid = spawn("tar xf ruby-2.0.0-p195.tar.bz2") ;TI"Process.wait pid ;TI" ;TI"9pid = spawn(RbConfig.ruby, "-eputs'Hello, world!'") ;TI"Process.wait pid ;T: @format0o; ; [I"QThis method is similar to Kernel#system but it doesn't wait for the command ;TI"to finish.;T@o; ; [ I"The parent process should ;TI"!use Process.wait to collect ;TI",the termination status of its child or ;TI"$use Process.detach to register ;TI""disinterest in their status; ;TI"Eotherwise, the operating system may accumulate zombie processes.;T@o; ; [I">spawn has bunch of options to specify process attributes:;T@o; ; [4I"env: hash ;TI"2 name => val : set the environment variable ;TI"4 name => nil : unset the environment variable ;TI" ;TI"A the keys and the values except for +nil+ must be strings. ;TI"command...: ;TI"_ commandline : command line string which is passed to the standard shell ;TI" cmdname, arg1, ... : command name and one or more arguments (This form does not use the shell. See below for caveats.) ;TI"a [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell) ;TI"options: hash ;TI"' clearing environment variables: ;TI"Z :unsetenv_others => true : clear environment variables except specified by env ;TI"< :unsetenv_others => false : don't clear (default) ;TI" process group: ;TI"9 :pgroup => true or 0 : make a new process group ;TI"A :pgroup => pgid : join the specified process group ;TI"I :pgroup => nil : don't change the process group (default) ;TI". create new process group: Windows only ;TI"[ :new_pgroup => true : the new process is the root process of a new process group ;TI"K :new_pgroup => false : don't create a new process group (default) ;TI"U resource limit: resourcename is core, cpu, data, etc. See Process.setrlimit. ;TI"' :rlimit_resourcename => limit ;TI"8 :rlimit_resourcename => [cur_limit, max_limit] ;TI" umask: ;TI" :umask => int ;TI" redirection: ;TI" key: ;TI"E FD : single file descriptor in child process ;TI"G [FD, FD, ...] : multiple file descriptor in child process ;TI" value: ;TI"Y FD : redirect to the file descriptor in parent process ;TI"V string : redirect to file with open(string, "r" or "w") ;TI"X [string] : redirect to file with open(string, File::RDONLY) ;TI"[ [string, open_mode] : redirect to file with open(string, open_mode, 0644) ;TI"[ [string, open_mode, perm] : redirect to file with open(string, open_mode, perm) ;TI"R [:child, FD] : redirect to the redirected file descriptor ;TI"R :close : close the file descriptor in child process ;TI" FD is one of follows ;TI"G :in : the file descriptor 0 which is the standard input ;TI"H :out : the file descriptor 1 which is the standard output ;TI"G :err : the file descriptor 2 which is the standard error ;TI"B integer : the file descriptor of specified the integer ;TI"@ io : the file descriptor specified as io.fileno ;TI"` file descriptor inheritance: close non-redirected non-standard fds (3, 4, 5, ...) or not ;TI"+ :close_others => false : inherit ;TI" current directory: ;TI" :chdir => str ;T; 0o; ; [ I"FThe cmdname, arg1, ... form does not use the shell. ;TI"BHowever, on different OSes, different things are provided as ;TI"Cbuilt-in commands. An example of this is +'echo'+, which is a ;TI"Ibuilt-in on Windows, but is a normal program on Linux and Mac OS X. ;TI"FThis means that Process.spawn 'echo', '%Path%' will ;TI"Fdisplay the contents of the %Path% environment variable ;TI"Gon Windows, but Process.spawn 'echo', '$PATH' prints ;TI" the literal $PATH.;T@o; ; [I"5If a hash is given as +env+, the environment is ;TI"Hupdated by +env+ before exec(2) in the child process. ;TI"FIf a pair in +env+ has nil as the value, the variable is deleted.;T@o; ; [I"%# set FOO as BAR and unset BAZ. ;TI"6pid = spawn({"FOO"=>"BAR", "BAZ"=>nil}, command) ;T; 0o; ; [I"&If a hash is given as +options+, ;TI"it specifies ;TI"process group, ;TI"create new process group, ;TI"resource limit, ;TI"current directory, ;TI"umask and ;TI"&redirects for the child process. ;TI">Also, it can be specified to clear environment variables.;T@o; ; [I"BThe :unsetenv_others key in +options+ specifies ;TI"Cto clear environment variables, other than specified by +env+.;T@o; ; [I"Lpid = spawn(command, :unsetenv_others=>true) # no environment variable ;TI"Mpid = spawn({"FOO"=>"BAR"}, command, :unsetenv_others=>true) # FOO only ;T; 0o; ; [ I"JThe :pgroup key in +options+ specifies a process group. ;TI"OThe corresponding value should be true, zero, a positive integer, or nil. ;TI"Ttrue and zero cause the process to be a process leader of a new process group. ;TI"XA non-zero positive integer causes the process to join the provided process group. ;TI"TThe default value, nil, causes the process to remain in the same process group.;T@o; ; [I":pid = spawn(command, :pgroup=>true) # process leader ;TI"Ipid = spawn(command, :pgroup=>10) # belongs to the process group 10 ;T; 0o; ; [ I"EThe :new_pgroup key in +options+ specifies to pass ;TI"N+CREATE_NEW_PROCESS_GROUP+ flag to CreateProcessW() that is ;TI"3Windows API. This option is only for Windows. ;TI"Ntrue means the new process is the root process of the new process group. ;TI"EThe new process has CTRL+C disabled. This flag is necessary for ;TI"@Process.kill(:SIGINT, pid) on the subprocess. ;TI"%:new_pgroup is false by default.;T@o; ; [I"Bpid = spawn(command, :new_pgroup=>true) # new process group ;TI"Cpid = spawn(command, :new_pgroup=>false) # same process group ;T; 0o; ; [ I"KThe :rlimit_foo key specifies a resource limit. ;TI"Mfoo should be one of resource types such as core. ;TI"PThe corresponding value should be an integer or an array which have one or ;TI"Atwo integers: same as cur_limit and max_limit arguments for ;TI"Process.setrlimit.;T@o; ; [ I")cur, max = Process.getrlimit(:CORE) ;TI"Kpid = spawn(command, :rlimit_core=>[0,max]) # disable core temporary. ;TI"@pid = spawn(command, :rlimit_core=>max) # enable core dump ;TI">pid = spawn(command, :rlimit_core=>0) # never dump core. ;T; 0o; ; [I"BThe :umask key in +options+ specifies the umask.;T@o; ; [I"'pid = spawn(command, :umask=>077) ;T; 0o; ; [I"VThe :in, :out, :err, an integer, an IO and an array key specifies a redirection. ;TI"AThe redirection maps a file descriptor in the child process.;T@o; ; [I">For example, stderr can be merged into stdout as follows:;T@o; ; [ I"&pid = spawn(command, :err=>:out) ;TI" pid = spawn(command, 2=>1) ;TI"(pid = spawn(command, STDERR=>:out) ;TI"*pid = spawn(command, STDERR=>STDOUT) ;T; 0o; ; [I"DThe hash keys specifies a file descriptor in the child process ;TI"started by #spawn. ;TI"E:err, 2 and STDERR specifies the standard error stream (stderr).;T@o; ; [I"GThe hash values specifies a file descriptor in the parent process ;TI"which invokes #spawn. ;TI"F:out, 1 and STDOUT specifies the standard output stream (stdout).;T@o; ; [I"In the above example, ;TI"@the standard output in the child process is not specified. ;TI"0So it is inherited from the parent process.;T@o; ; [I"LThe standard input stream (stdin) can be specified by :in, 0 and STDIN.;T@o; ; [I"1A filename can be specified as a hash value.;T@o; ; [ I"8pid = spawn(command, :in=>"/dev/null") # read mode ;TI":pid = spawn(command, :out=>"/dev/null") # write mode ;TI"4pid = spawn(command, :err=>"log") # write mode ;TI"Bpid = spawn(command, [:out, :err]=>"/dev/null") # write mode ;TI"6pid = spawn(command, 3=>"/dev/null") # read mode ;T; 0o; ; [I"6For stdout and stderr (and combination of them), ;TI"!it is opened in write mode. ;TI"!Otherwise read mode is used.;T@o; ; [I"FFor specifying flags and permission of file creation explicitly, ;TI"an array is used instead.;T@o; ; [ I"@pid = spawn(command, :in=>["file"]) # read mode is assumed ;TI".pid = spawn(command, :in=>["file", "r"]) ;TI"=pid = spawn(command, :out=>["log", "w"]) # 0644 assumed ;TI"4pid = spawn(command, :out=>["log", "w", 0600]) ;TI"Tpid = spawn(command, :out=>["log", File::WRONLY|File::EXCL|File::CREAT, 0600]) ;T; 0o; ; [ I";The array specifies a filename, flags and permission. ;TI".The flags can be a string or an integer. ;TI">If the flags is omitted or nil, File::RDONLY is assumed. ;TI"*The permission should be an integer. ;TI":If the permission is omitted or nil, 0644 is assumed.;T@o; ; [I"BIf an array of IOs and integers are specified as a hash key, ;TI"%all the elements are redirected.;T@o; ; [I"4# stdout and stderr is redirected to log file. ;TI"+# The file "log" is opened just once. ;TI"6pid = spawn(command, [:out, :err]=>["log", "w"]) ;T; 0o; ; [ I"EAnother way to merge multiple file descriptors is [:child, fd]. ;TI"C\[:child, fd] means the file descriptor in the child process. ;TI" This is different from fd. ;TI"NFor example, :err=>:out means redirecting child stderr to parent stdout. ;TI"NBut :err=>[:child, :out] means redirecting child stderr to child stdout. ;TI"IThey differ if stdout is redirected in the child process as follows.;T@o; ; [I"4# stdout and stderr is redirected to log file. ;TI"+# The file "log" is opened just once. ;TI"Dpid = spawn(command, :out=>["log", "w"], :err=>[:child, :out]) ;T; 0o; ; [I"J\[:child, :out] can be used to merge stderr into stdout in IO.popen. ;TI"LIn this case, IO.popen redirects stdout to a pipe in the child process ;TI"5and [:child, :out] refers the redirected stdout.;T@o; ; [I"Qio = IO.popen(["sh", "-c", "echo out; echo err >&2", :err=>[:child, :out]]) ;TI" p io.read #=> "out\nerr\n" ;T; 0o; ; [I"NThe :chdir key in +options+ specifies the current directory.;T@o; ; [I".pid = spawn(command, :chdir=>"/var/tmp") ;T; 0o; ; [ I"Gspawn closes all non-standard unspecified descriptors by default. ;TI"0The "standard" descriptors are 0, 1 and 2. ;TI"9This behavior is specified by :close_others option. ;TI"E:close_others doesn't affect the standard descriptors which are ;TI"3closed only if :close is specified explicitly.;T@o; ; [I"Lpid = spawn(command, :close_others=>true) # close 3,4,5,... (default) ;TI"Hpid = spawn(command, :close_others=>false) # don't close 3,4,5,... ;T; 0o; ; [I">:close_others is false by default for spawn and IO.popen.;T@o; ; [I"FNote that fds which close-on-exec flag is already set are closed ;TI"(regardless of :close_others option.;T@o; ; [I"2So IO.pipe and spawn can be used as IO.popen.;T@o; ; [ I"(# similar to r = IO.popen(command) ;TI"r, w = IO.pipe ;TI"Lpid = spawn(command, :out=>w) # r, w is closed in the child process. ;TI" w.close ;T; 0o; ; [I"D:close is specified as a hash value to close a fd individually.;T@o; ; [I"f = open(foo) ;TI":system(command, f=>:close) # don't inherit f. ;T; 0o; ; [I"0If a file descriptor need to be inherited, ;TI"io=>io can be used.;T@o; ; [ I"9# valgrind has --log-fd option for log destination. ;TI"F# log_w=>log_w indicates log_w.fileno inherits to child process. ;TI"log_r, log_w = IO.pipe ;TI"Tpid = spawn("valgrind", "--log-fd=#{log_w.fileno}", "echo", "a", log_w=>log_w) ;TI"log_w.close ;TI"p log_r.read ;T; 0o; ; [I"6It is also possible to exchange file descriptors.;T@o; ; [I"2pid = spawn(command, :out=>:err, :err=>:out) ;T; 0o; ; [ I"BThe hash keys specify file descriptors in the child process. ;TI"GThe hash values specifies file descriptors in the parent process. ;TI":So the above specifies exchanging stdout and stderr. ;TI"NInternally, +spawn+ uses an extra file descriptor to resolve such cyclic ;TI"file descriptor mapping.;T@o; ; [I",See Kernel.exec for the standard shell.;T: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"kspawn([env,] command... [,options]) -> pid Process.spawn([env,] command... [,options]) -> pid ;T0[I" (*args);T@EFI" Kernel;TcRDoc::NormalModule00PK]Z=~~jj-i.rinu[U:RDoc::AnyMethod[iI"jj:ETI"Kernel#jj;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GOutputs _objs_ to STDOUT as JSON strings in a pretty format, with ;TI"%indentation and over many lines.;T: @fileI" ext/json/lib/json/common.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*objs);T@FI" Kernel;TcRDoc::NormalModule00PK]#yytrace_var-i.rinu[U:RDoc::AnyMethod[iI"trace_var:ETI"Kernel#trace_var;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"HControls tracing of assignments to global variables. The parameter ;TI"D+symbol+ identifies the variable (as either a string name or a ;TI";symbol identifier). _cmd_ (which may be a string or a ;TI"?+Proc+ object) or block is executed whenever the variable ;TI":is assigned. The block or +Proc+ object receives the ;TI"3variable's new value as a parameter. Also see ;TI"Kernel::untrace_var.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"8trace_var :$_, proc {|v| puts "$_ is now '#{v}'" } ;TI"$_ = "hello" ;TI"$_ = ' there' ;T: @format0o; ; [I"produces:;T@o; ; [I"$_ is now 'hello' ;TI"$_ is now ' there';T; 0: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below0I"[trace_var(symbol, cmd ) -> nil trace_var(symbol) {|val| block } -> nil ;T0[I" (*args);T@!FI" Kernel;TcRDoc::NormalModule00PK]X4pp-i.rinu[U:RDoc::AnyMethod[iI"pp:ETI"Kernel#pp;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"%prints arguments in pretty form.;To:RDoc::Markup::BlankLineo; ; [I"pp returns argument(s).;T: @fileI"lib/pp.rb;T:0@omit_headings_from_table_of_contents_below000[[I"pp;To;; [o; ; [I""suppress redefinition warning;T; I"prelude.rb;T; 0I" (*objs);T@FI" Kernel;TcRDoc::NormalModule00PK]f9İ>> proc-i.rinu[U:RDoc::AnyMethod[iI" proc:ETI"Kernel#proc;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Equivalent to Proc.new.;T: @fileI" proc.c;T:0@omit_headings_from_table_of_contents_below0I"'proc { |...| block } -> a_proc ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]AVM77 class-i.rinu[U:RDoc::AnyMethod[iI" class:ETI"Kernel#class;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns the class of obj. This method must always be called ;TI"Ewith an explicit receiver, as #class is also a reserved word in ;TI" Ruby.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1.class #=> Integer ;TI"self.class #=> Object;T: @format0: @fileI"kernel.rb;T:0@omit_headings_from_table_of_contents_below0I"obj.class -> class ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]~Wpp-c.rinu[U:RDoc::AnyMethod[iI"pp:ETI"Kernel::pp;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"%prints arguments in pretty form.;To:RDoc::Markup::BlankLineo; ; [I"pp returns argument(s).;T: @fileI"lib/pp.rb;T:0@omit_headings_from_table_of_contents_below000[[I"pp;To;; [o; ; [I""suppress redefinition warning;T; I"prelude.rb;T; 0I" (*objs);T@FI" Kernel;TcRDoc::NormalModule00PK]"krr gets-i.rinu[U:RDoc::AnyMethod[iI" gets:ETI"Kernel#gets;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JReturns (and assigns to $_) the next line from the list ;TI"Hof files in +ARGV+ (or $*), or from standard input if ;TI"Gno files are present on the command line. Returns +nil+ at end of ;TI"Efile. The optional argument specifies the record separator. The ;TI"Iseparator is included with the contents of each record. A separator ;TI"Eof +nil+ reads the entire contents, and a zero-length separator ;TI"Creads the input one paragraph at a time, where paragraphs are ;TI"Gdivided by two consecutive newlines. If the first argument is an ;TI"Iinteger, or optional second argument is given, the returning string ;TI"Ewould not be longer than the given value in bytes. If multiple ;TI"Gfilenames are present in +ARGV+, gets(nil) will read ;TI"%the contents one file at a time.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"ARGV << "testfile" ;TI"print while gets ;T: @format0o; ; [I"produces:;T@o; ; [ I"This is line one ;TI"This is line two ;TI"This is line three ;TI"And so on... ;T; 0o; ; [I"CThe style of programming using $_ as an implicit ;TI"?parameter is gradually losing favor in the Ruby community.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"gets(sep=$/ [, getline_args]) -> string or nil gets(limit [, getline_args]) -> string or nil gets(sep, limit [, getline_args]) -> string or nil ;T0[I" (*args);T@+FI" Kernel;TcRDoc::NormalModule00PK]nNN then-i.rinu[U:RDoc::AnyMethod[iI" then:ETI"Kernel#then;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"BYields self to the block and returns the result of the block.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"83.next.then {|x| x**x }.to_s #=> "256" ;T: @format0o; ; [I" 1 ;TI"+# does not meet condition, drop value ;TI".2.then.detect(&:odd?) # => nil;T; 0: @fileI"kernel.rb;T:0@omit_headings_from_table_of_contents_below0I"1obj.then {|x| block } -> an_object ;TI" self;T[I"();T@(FI" Kernel;TcRDoc::NormalModule00PK]C exec-i.rinu[U:RDoc::AnyMethod[iI" exec:ETI"Kernel#exec;TF: privateo:RDoc::Markup::Document: @parts[&o:RDoc::Markup::Paragraph; [I"QReplaces the current process by running the given external _command_, which ;TI")can take one of the following forms:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: LABEL: @items[o:RDoc::Markup::ListItem: @label[I"#exec(commandline);T; [o; ; [I">command line string which is passed to the standard shell;To;;[I"*exec(cmdname, arg1, ...);T; [o; ; [I"6command name and one or more arguments (no shell);To;;[I"3exec([cmdname, argv0], arg1, ...);T; [o; ; [I"@command name, argv[0] and zero or more arguments (no shell);T@o; ; [I"QIn the first form, the string is taken as a command line that is subject to ;TI"+shell expansion before being executed.;T@o; ; [ I"RThe standard shell always means "/bin/sh" on Unix-like systems, ;TI"Potherwise, ENV["RUBYSHELL"] or ENV["COMSPEC"] on ;TI"GWindows and similar. The command is passed as an argument to the ;TI"L"-c" switch to the shell, except in the case of +COMSPEC+.;T@o; ; [I"NIf the string from the first form (exec("command")) follows ;TI"these simple rules:;T@o; ; : BULLET;[o;;0; [o; ; [I"no meta characters;To;;0; [o; ; [I">not starting with shell reserved word or special built-in;To;;0; [o; ; [I"4Ruby invokes the command directly without shell;T@o; ; [I"PYou can force shell invocation by adding ";" to the string (because ";" is ;TI"a meta character).;T@o; ; [I";Note that this behavior is observable by pid obtained ;TI"Q(return value of spawn() and IO#pid for IO.popen) is the pid of the invoked ;TI"command, not shell.;T@o; ; [I"PIn the second form (exec("command1", "arg1", ...)), the first ;TI"Qis taken as a command name and the rest are passed as parameters to command ;TI"with no shell expansion.;T@o; ; [ I"OIn the third form (exec(["command", "argv0"], "arg1", ...)), ;TI"Mstarting a two-element array at the beginning of the command, the first ;TI"Oelement is the command to be executed, and the second argument is used as ;TI"Kthe argv[0] value, which may show up in process listings.;T@o; ; [I"MIn order to execute the command, one of the exec(2) system ;TI"Pcalls are used, so the running command may inherit some of the environment ;TI"?of the original program (including open file descriptors).;T@o; ; [I"PThis behavior is modified by the given +env+ and +options+ parameters. See ;TI"::spawn for details.;T@o; ; [I"CIf the command fails to execute (typically Errno::ENOENT when ;TI"=it was not found) a SystemCallError exception is raised.;T@o; ; [I"QThis method modifies process attributes according to given +options+ before ;TI"Nexec(2) system call. See ::spawn for more details about the ;TI"given +options+.;T@o; ; [I"NThe modified attributes may be retained when exec(2) system ;TI"call fails.;T@o; ; [I":For example, hard resource limits are not restorable.;T@o; ; [I"OConsider to create a child process using ::spawn or Kernel#system if this ;TI"is not acceptable.;T@o:RDoc::Markup::Verbatim; [ I"Eexec "echo *" # echoes list of files in current directory ;TI"# never get here ;TI" ;TI".exec "echo", "*" # echoes an asterisk ;TI"# never get here;T: @format0: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"(exec([env,] command... [,options]) ;T0[I" (*args);T@~FI" Kernel;TcRDoc::NormalModule00PK]5 JSON-i.rinu[U:RDoc::AnyMethod[iI" JSON:ETI"Kernel#JSON;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RIf _object_ is string-like, parse the string and return the parsed result as ;TI"Oa Ruby data structure. Otherwise, generate a JSON text from the Ruby data ;TI"$structure object and return it.;To:RDoc::Markup::BlankLineo; ; [I"OThe _opts_ argument is passed through to generate/parse respectively. See ;TI"0generate and parse for their documentation.;T: @fileI" ext/json/lib/json/common.rb;T:0@omit_headings_from_table_of_contents_below000[I"(object, *args);T@FI" Kernel;TcRDoc::NormalModule00PK]8APf__method__-i.rinu[U:RDoc::AnyMethod[iI"__method__:ETI"Kernel#__method__;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CReturns the name at the definition of the current method as a ;TI" Symbol. ;TI"@If called outside of a method, it returns nil.;T: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below0I""__method__ -> symbol ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]= 66untrace_var-i.rinu[U:RDoc::AnyMethod[iI"untrace_var:ETI"Kernel#untrace_var;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"CRemoves tracing for the specified command on the given global ;TI"=variable and returns +nil+. If no command is specified, ;TI"@removes all tracing for that variable and returns an array ;TI".containing the commands actually removed.;T: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below0I"4untrace_var(symbol [, cmd] ) -> array or nil ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK] mmj-i.rinu[U:RDoc::AnyMethod[iI"j:ETI" Kernel#j;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OOutputs _objs_ to STDOUT as JSON strings in the shortest form, that is in ;TI"one line.;T: @fileI" ext/json/lib/json/common.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*objs);T@FI" Kernel;TcRDoc::NormalModule00PK]0J sleep-i.rinu[U:RDoc::AnyMethod[iI" sleep:ETI"Kernel#sleep;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"RSuspends the current thread for _duration_ seconds (which may be any number, ;TI"Pincluding a +Float+ with fractional seconds). Returns the actual number of ;TI"Oseconds slept (rounded), which may be less than that asked for if another ;TI"Bthread calls Thread#run. Called without an argument, sleep() ;TI"will sleep forever.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"/Time.new #=> 2008-03-08 19:56:19 +0900 ;TI"sleep 1.2 #=> 1 ;TI"/Time.new #=> 2008-03-08 19:56:20 +0900 ;TI"sleep 1.9 #=> 2 ;TI".Time.new #=> 2008-03-08 19:56:22 +0900;T: @format0: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"%sleep([duration]) -> integer ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]ěreadlines-i.rinu[U:RDoc::AnyMethod[iI"readlines:ETI"Kernel#readlines;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?Returns an array containing the lines returned by calling ;TI"@Kernel.gets(sep) until the end of file.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"breadlines(sep=$/) -> array readlines(limit) -> array readlines(sep, limit) -> array ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]i} gsub-i.rinu[U:RDoc::AnyMethod[iI" gsub:ETI"Kernel#gsub;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HEquivalent to $_.gsub..., except that $_ ;TI"-will be updated if substitution occurs. ;TI"=Available only when -p/-n command line option specified.;T: @fileI" ruby.c;T:0@omit_headings_from_table_of_contents_below0I"Mgsub(pattern, replacement) -> $_ gsub(pattern) {|...| block } -> $_ ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]O0 clone-i.rinu[U:RDoc::AnyMethod[iI" clone:ETI"Kernel#clone;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"GProduces a shallow copy of obj---the instance variables of ;TI"@obj are copied, but not the objects they reference. ;TI"D#clone copies the frozen value state of obj, unless the ;TI"E+:freeze+ keyword argument is given with a false or true value. ;TI".See also the discussion under Object#dup.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"class Klass ;TI" attr_accessor :str ;TI" end ;TI"1s1 = Klass.new #=> # ;TI"%s1.str = "Hello" #=> "Hello" ;TI">s2 = s1.clone #=> # ;TI"!s2.str[1,4] = "i" #=> "i" ;TI"?s1.inspect #=> "#" ;TI"?s2.inspect #=> "#" ;T: @format0o; ; [I"@This method may have class-specific behavior. If so, that ;TI"Hbehavior will be documented under the #+initialize_copy+ method of ;TI"the class.;T: @fileI"kernel.rb;T:0@omit_headings_from_table_of_contents_below0I")obj.clone(freeze: nil) -> an_object ;T0[I"(freeze: nil);T@#FI" Kernel;TcRDoc::NormalModule00PK]bB7sub-i.rinu[U:RDoc::AnyMethod[iI"sub:ETI"Kernel#sub;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"AEquivalent to $_.sub(args), except that ;TI"=$_ will be updated if substitution occurs. ;TI"=Available only when -p/-n command line option specified.;T: @fileI" ruby.c;T:0@omit_headings_from_table_of_contents_below0I"Isub(pattern, replacement) -> $_ sub(pattern) {|...| block } -> $_ ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK](__callee__-i.rinu[U:RDoc::AnyMethod[iI"__callee__:ETI"Kernel#__callee__;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@Returns the called name of the current method as a Symbol. ;TI"@If called outside of a method, it returns nil.;T: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below0I""__callee__ -> symbol ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]gem-i.rinu[U:RDoc::AnyMethod[iI"gem:ETI"Kernel#gem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"AUse Kernel#gem to activate a specific version of +gem_name+.;To:RDoc::Markup::BlankLineo; ; [I"?+requirements+ is a list of version requirements that the ;TI"Nspecified gem must match, most commonly "= example.version.number". See ;TI"?Gem::Requirement for how to specify a version requirement.;T@o; ; [I"PIf you will be activating the latest version of a gem, there is no need to ;TI"Ecall Kernel#gem, Kernel#require will do the right thing for you.;T@o; ; [I"PKernel#gem returns true if the gem was activated, otherwise false. If the ;TI"Igem could not be found, didn't match the version requirements, or a ;TI"Jdifferent version was already activated, an exception will be raised.;T@o; ; [I"LKernel#gem should be called *before* any require statements (otherwise ;TI"6RubyGems may load a conflicting library version).;T@o; ; [I"NKernel#gem only loads prerelease versions when prerelease +requirements+ ;TI"are given:;T@o:RDoc::Markup::Verbatim; [I"#gem 'rake', '>= 1.1.a', '< 2' ;T: @format0o; ; [ I"LIn older RubyGems versions, the environment variable GEM_SKIP could be ;TI"Pused to skip activation of specified gems, for example to test out changes ;TI"Ithat haven't been installed yet. Now RubyGems defers to -I and the ;TI">RUBYLIB environment variable to skip activation of a gem.;T@o; ; [I" Example:;T@o; ; [I" nil ;T0[I" (p1, p2);T@FI" Kernel;TcRDoc::NormalModule00PK]˅ !  test-i.rinu[U:RDoc::AnyMethod[iI" test:ETI"Kernel#test;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"IUses the character +cmd+ to perform various tests on +file1+ (first ;TI";table below) or on +file1+ and +file2+ (second table).;To:RDoc::Markup::BlankLineo; ; [I"!File tests on a single file:;T@o:RDoc::Markup::Verbatim; [*I"Cmd Returns Meaning ;TI"1"A" | Time | Last access time for file1 ;TI"6"b" | boolean | True if file1 is a block device ;TI":"c" | boolean | True if file1 is a character device ;TI"1"C" | Time | Last change time for file1 ;TI">"d" | boolean | True if file1 exists and is a directory ;TI"+"e" | boolean | True if file1 exists ;TI"A"f" | boolean | True if file1 exists and is a regular file ;TI"<"g" | boolean | True if file1 has the \CF{setgid} bit ;TI"+ | | set (false under NT) ;TI";"G" | boolean | True if file1 exists and has a group ;TI"< | | ownership equal to the caller's group ;TI"F"k" | boolean | True if file1 exists and has the sticky bit set ;TI"B"l" | boolean | True if file1 exists and is a symbolic link ;TI"7"M" | Time | Last modification time for file1 ;TI";"o" | boolean | True if file1 exists and is owned by ;TI"1 | | the caller's effective uid ;TI";"O" | boolean | True if file1 exists and is owned by ;TI", | | the caller's real uid ;TI"9"p" | boolean | True if file1 exists and is a fifo ;TI"A"r" | boolean | True if file1 is readable by the effective ;TI", | | uid/gid of the caller ;TI";"R" | boolean | True if file is readable by the real ;TI", | | uid/gid of the caller ;TI"B"s" | int/nil | If file1 has nonzero size, return the size, ;TI"+ | | otherwise return nil ;TI";"S" | boolean | True if file1 exists and is a socket ;TI";"u" | boolean | True if file1 has the setuid bit set ;TI">"w" | boolean | True if file1 exists and is writable by ;TI", | | the effective uid/gid ;TI">"W" | boolean | True if file1 exists and is writable by ;TI"' | | the real uid/gid ;TI"@"x" | boolean | True if file1 exists and is executable by ;TI", | | the effective uid/gid ;TI"@"X" | boolean | True if file1 exists and is executable by ;TI"' | | the real uid/gid ;TI"A"z" | boolean | True if file1 exists and has a zero length ;T: @format0o; ; [I"Tests that take two files:;T@o; ; [ I"<"-" | boolean | True if file1 and file2 are identical ;TI">"=" | boolean | True if the modification times of file1 ;TI"* | | and file2 are equal ;TI"="<" | boolean | True if the modification time of file1 ;TI"0 | | is prior to that of file2 ;TI"=">" | boolean | True if the modification time of file1 ;TI", | | is after that of file2;T; 0: @fileI" file.c;T:0@omit_headings_from_table_of_contents_below0I"(test(cmd, file1 [, file2] ) -> obj ;T0[I" (*args);T@FFI" Kernel;TcRDoc::NormalModule00PK]M@@ catch-i.rinu[U:RDoc::AnyMethod[iI" catch:ETI"Kernel#catch;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"N+catch+ executes its block. If +throw+ is not called, the block executes ;TI"Nnormally, and +catch+ returns the value of the last expression evaluated.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"*catch(1) { 123 } # => 123 ;T: @format0o; ; [ I"PIf throw(tag2, val) is called, Ruby searches up its stack for ;TI"Qa +catch+ block whose +tag+ has the same +object_id+ as _tag2_. When found, ;TI"Qthe block stops executing and returns _val_ (or +nil+ if no second argument ;TI"was given to +throw+).;T@o; ; [I"*catch(1) { throw(1, 456) } # => 456 ;TI"*catch(1) { throw(1) } # => nil ;T; 0o; ; [I"JWhen +tag+ is passed as the first argument, +catch+ yields it as the ;TI"parameter of the block.;T@o; ; [I"(catch(1) {|x| x + 2 } # => 3 ;T; 0o; ; [I"IWhen no +tag+ is given, +catch+ yields a new unique object (as from ;TI"O+Object.new+) as the block parameter. This object can then be used as the ;TI"Cargument to +throw+, and will match the correct +catch+ block.;T@o; ; [I"catch do |obj_A| ;TI" catch do |obj_B| ;TI" throw(obj_B, 123) ;TI") puts "This puts is not reached" ;TI" end ;TI" ;TI"% puts "This puts is displayed" ;TI" 456 ;TI" end ;TI" ;TI"# => 456 ;TI" ;TI"catch do |obj_A| ;TI" catch do |obj_B| ;TI" throw(obj_A, 123) ;TI"/ puts "This puts is still not reached" ;TI" end ;TI" ;TI"0 puts "Now this puts is also not reached" ;TI" 456 ;TI" end ;TI" ;TI" # => 123;T; 0: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I")catch([tag]) {|tag| block } -> obj ;T0[I" (*args);T@BFI" Kernel;TcRDoc::NormalModule00PK]- exit-i.rinu[U:RDoc::AnyMethod[iI" exit:ETI"Kernel#exit;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"AInitiates the termination of the Ruby script by raising the ;TI"=SystemExit exception. This exception may be caught. The ;TI"Hoptional parameter is used to return a status code to the invoking ;TI"environment. ;TI">+true+ and +FALSE+ of _status_ means success and failure ;TI"Crespectively. The interpretation of other integer values are ;TI"system dependent.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I" begin ;TI" exit ;TI" puts "never get here" ;TI"rescue SystemExit ;TI"- puts "rescued a SystemExit exception" ;TI" end ;TI"puts "after begin block" ;T: @format0o; ; [I"produces:;T@o; ; [I"$rescued a SystemExit exception ;TI"after begin block ;T; 0o; ; [I"GJust prior to termination, Ruby executes any at_exit ;TI"Dfunctions (see Kernel::at_exit) and runs any object finalizers ;TI")(see ObjectSpace::define_finalizer).;T@o; ; [I")at_exit { puts "at_exit function" } ;TI"KObjectSpace.define_finalizer("string", proc { puts "in finalizer" }) ;TI" exit ;T; 0o; ; [I"produces:;T@o; ; [I"at_exit function ;TI"in finalizer;T; 0: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"Lexit(status=true) Kernel::exit(status=true) Process::exit(status=true) ;T0[I" (*args);T@6FI" Kernel;TcRDoc::NormalModule00PK]1{OO require-i.rinu[U:RDoc::AnyMethod[iI" require:ETI"Kernel#require;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OLoads the given +name+, returning +true+ if successful and +false+ if the ;TI"feature is already loaded.;To:RDoc::Markup::BlankLineo; ; [ I"JIf the filename neither resolves to an absolute path nor starts with ;TI"A'./' or '../', the file will be searched for in the library ;TI"Fdirectories listed in $LOAD_PATH ($:). ;TI"OIf the filename starts with './' or '../', resolution is based on Dir.pwd.;T@o; ; [ I"PIf the filename has the extension ".rb", it is loaded as a source file; if ;TI"Lthe extension is ".so", ".o", or ".dll", or the default shared library ;TI"Kextension on the current platform, Ruby loads the shared library as a ;TI"KRuby extension. Otherwise, Ruby tries adding ".rb", ".so", and so on ;TI"Nto the name until found. If the file named cannot be found, a LoadError ;TI"will be raised.;T@o; ; [I"GFor Ruby extensions the filename given may use any shared library ;TI"Oextension. For example, on Linux the socket extension is "socket.so" and ;TI"Frequire 'socket.dll' will load the socket extension.;T@o; ; [ I"6The absolute path of the loaded file is added to ;TI"J$LOADED_FEATURES ($"). A file will not be ;TI"Ploaded again if its path already appears in $". For example, ;TI"Mrequire 'a'; require './a' will not load a.rb ;TI" again.;T@o:RDoc::Markup::Verbatim; [I"require "my-library.rb" ;TI"require "db-driver" ;T: @format0o; ; [I"NAny constants or globals within the loaded source file will be available ;TI"Nin the calling program's global namespace. However, local variables will ;TI"2not be propagated to the loading environment.;T: @fileI" load.c;T:0@omit_headings_from_table_of_contents_below0I"'require(name) -> true or false ;T0[[I"gem_original_require;To;; [;I",lib/rubygems/core_ext/kernel_require.rb;T;0I" (p1);T@3FI" Kernel;TcRDoc::NormalModule00PK]&A''require_relative-i.rinu[U:RDoc::AnyMethod[iI"require_relative:ETI"Kernel#require_relative;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MRuby tries to load the library named _string_ relative to the requiring ;TI"Rfile's path. If the file's path cannot be determined a LoadError is raised. ;TI"@If a file is loaded +true+ is returned and false otherwise.;T: @fileI" load.c;T:0@omit_headings_from_table_of_contents_below0I"/require_relative(string) -> true or false ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00PK]{8@55cdesc-Kernel.rinu[U:RDoc::NormalModule[iI" Kernel:ET@0o:RDoc::Markup::Document: @parts[o;;[: @fileI" ext/json/lib/json/common.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"'ext/objspace/lib/objspace/trace.rb;T; 0o;;[; I"ext/psych/lib/psych/y.rb;T; 0o;;[; I"kernel.rb;T; 0o;;[; I"lib/pp.rb;T; 0o;;[o:RDoc::Markup::Paragraph;[ I"PRubyGems adds the #gem method to allow activation of specific gem versions ;TI"Pand overrides the #require method on Kernel to make gems appear as if they ;TI"Rlive on the $LOAD_PATH. See the documentation of these methods ;TI"for further detail.;T; I"(lib/rubygems/core_ext/kernel_gem.rb;T; 0o;;[; I",lib/rubygems/core_ext/kernel_require.rb;T; 0o;;[; I")lib/rubygems/core_ext/kernel_warn.rb;T; 0o;;[; I"lib/uri/common.rb;T; 0o;;[3o; ;[I"GThe Kernel module is included by class Object, so its methods are ;TI"$available in every Ruby object.;To:RDoc::Markup::BlankLineo; ;[I"JThe Kernel instance methods are documented in class Object while the ;TI"Mmodule methods are documented here. These methods are called without a ;TI"8receiver and thus can be called in functional form:;T@1o:RDoc::Markup::Verbatim;[I"%sprintf "%.1f", 1.234 #=> "1.2" ;T: @format0S:RDoc::Markup::Heading: leveli: textI"What's Here;T@1o; ;[I":\Module \Kernel provides methods that are useful for:;T@1o:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I"2{Converting}[#module-Kernel-label-Converting];To;;0;[o; ;[I".{Querying}[#module-Kernel-label-Querying];To;;0;[o; ;[I",{Exiting}[#module-Kernel-label-Exiting];To;;0;[o; ;[I"2{Exceptions}[#module-Kernel-label-Exceptions];To;;0;[o; ;[I""{IO}[#module-Kernel-label-IO];To;;0;[o; ;[I"({Procs}[#module-Kernel-label-Procs];To;;0;[o; ;[I",{Tracing}[#module-Kernel-label-Tracing];To;;0;[o; ;[I"6{Subprocesses}[#module-Kernel-label-Subprocesses];To;;0;[o; ;[I",{Loading}[#module-Kernel-label-Loading];To;;0;[o; ;[I".{Yielding}[#module-Kernel-label-Yielding];To;;0;[o; ;[I"8{Random Values}[#module-Kernel-label-Random+Values];To;;0;[o; ;[I"({Other}[#module-Kernel-label-Other];T@1S;;i;I"Converting;T@1o;;;;[ o;;0;[o;;: NOTE;[o;;[I"{#Array}[#method-i-Array];T;[o; ;[I"2Returns an Array based on the given argument.;To;;0;[o;;;;[o;;[I""{#Complex}[#method-i-Complex];T;[o; ;[I"4Returns a Complex based on the given arguments.;To;;0;[o;;;;[o;;[I"{#Float}[#method-i-Float];T;[o; ;[I"2Returns a Float based on the given arguments.;To;;0;[o;;;;[o;;[I"{#Hash}[#method-i-Hash];T;[o; ;[I"0Returns a Hash based on the given argument.;To;;0;[o;;;;[o;;[I""{#Integer}[#method-i-Integer];T;[o; ;[I"5Returns an Integer based on the given arguments.;To;;0;[o;;;;[o;;[I"${#Rational}[#method-i-Rational];T;[o; ;[I"Returns a Rational ;TI""based on the given arguments.;To;;0;[o;;;;[o;;[I" {#String}[#method-i-String];T;[o; ;[I"2Returns a String based on the given argument.;T@1S;;i;I" Querying;T@1o;;;;[o;;0;[o;;;;[o;;[I"({#__callee__}[#method-i-__callee__];T;[o; ;[I"Returns the called name ;TI"'of the current method as a symbol.;To;;0;[o;;;;[o;;[I""{#__dir__}[#method-i-__dir__];T;[o; ;[I"'Returns the path to the directory ;TI"-from which the current method is called.;To;;0;[o;;;;[o;;[I"({#__method__}[#method-i-__method__];T;[o; ;[I"Returns the name ;TI"'of the current method as a symbol.;To;;0;[o;;;;[o;;[I"#autoload?;T;[o; ;[I"GReturns the file to be loaded when the given module is referenced.;To;;0;[o;;;;[o;;[I" #binding;T;[o; ;[I"Exits the current process without calling any registered ;TI"+at_exit+ handlers.;T@1S;;i;I"Exceptions;T@1o;;;;[o;;0;[o;;;;[o;;[I" #catch;T;[o; ;[I"AExecutes the given block, possibly catching a thrown object.;To;;0;[o;;;;[o;;[I"#raise (aliased as #fail);T;[o; ;[I"6Raises an exception based on the given arguments.;To;;0;[o;;;;[o;;[I" #throw;T;[o; ;[I"CReturns from the active catch block waiting for the given tag.;T@1S;;i;I"\IO;T@1o;;;;[o;;0;[o;;;;[o;;[I" #gets;T;[o; ;[I"MReturns and assigns to $_ the next line from the current input.;To;;0;[o;;;;[o;;[I" #open;T;[o; ;[I"MCreates an IO object connected to the given stream, file, or subprocess.;To;;0;[o;;;;[o;;[I"#p;T;[o; ;[I"EPrints the given objects' inspect output to the standard output.;To;;0;[o;;;;[o;;[I"#pp;T;[o; ;[I"-Prints the given objects in pretty form.;To;;0;[o;;;;[o;;[I" #print;T;[o; ;[I"CPrints the given objects to standard output without a newline.;To;;0;[o;;;;[o;;[I" #printf;T;[o; ;[I"GPrints the string resulting from applying the given format string ;TI"!to any additional arguments.;To;;0;[o;;;;[o;;[I" #putc;T;[o; ;[I"FEquivalent to for the given object.;To;;0;[o;;;;[o;;[I" #puts;T;[o; ;[I"IEquivalent to $stdout.puts(*objects) for the given objects.;To;;0;[o;;;;[o;;[I"#readline;T;[o; ;[I"BSimilar to #gets, but raises an exception at the end of file.;To;;0;[o;;;;[o;;[I"#readlines;T;[o; ;[I"DReturns an array of the remaining lines from the current input.;To;;0;[o;;;;[o;;[I" #select;T;[o; ;[I"Same as IO.select.;T@1S;;i;I" Procs;T@1o;;;;[o;;0;[o;;;;[o;;[I" #lambda;T;[o; ;[I"/Returns a lambda proc for the given block.;To;;0;[o;;;;[o;;[I" #proc;T;[o; ;[I"0Returns a new Proc; equivalent to Proc.new.;T@1S;;i;I" Tracing;T@1o;;;;[o;;0;[o;;;;[o;;[I"#set_trace_func;T;[o; ;[I"5Sets the given proc as the handler for tracing, ;TI"(or disables tracing if given +nil+.;To;;0;[o;;;;[o;;[I"#trace_var;T;[o; ;[I"=Starts tracing assignments to the given global variable.;To;;0;[o;;;;[o;;[I"#untrace_var;T;[o; ;[I"BDisables tracing of assignments to the given global variable.;T@1S;;i;I"Subprocesses;T@1o;;;;[ o;;0;[o;;;;[o;;[I" #`cmd`;T;[o; ;[I"@Returns the standard output of running +cmd+ in a subshell.;To;;0;[o;;;;[o;;[I" #exec;T;[o; ;[I"1Replaces current process with a new process.;To;;0;[o;;;;[o;;[I" #fork;T;[o; ;[I"2Forks the current process into two processes.;To;;0;[o;;;;[o;;[I" #spawn;T;[o; ;[I"DExecutes the given command and returns its pid without waiting ;TI"for completion.;To;;0;[o;;;;[o;;[I" #system;T;[o; ;[I".Executes the given command in a subshell.;T@1S;;i;I" Loading;T@1o;;;;[ o;;0;[o;;;;[o;;[I"#autoload;T;[o; ;[I"CRegisters the given file to be loaded when the given constant ;TI"is first referenced.;To;;0;[o;;;;[o;;[I" #load;T;[o; ;[I"Loads the given Ruby file.;To;;0;[o;;;;[o;;[I" #require;T;[o; ;[I"ALoads the given Ruby file unless it has already been loaded.;To;;0;[o;;;;[o;;[I"#require_relative;T;[o; ;[I"$LOAD_PATH ($:). ;TI"KIf the file is found in a directory, it will attempt to load the file ;TI"Irelative to that directory. If the file is not found in any of the ;TI"Kdirectories in $LOAD_PATH, the file will be loaded using ;TI"2the relative path from the current directory.;T@o; ; [I"FIf the file doesn't exist when there is an attempt to load it, a ;TI"LoadError will be raised.;T@o; ; [ I"HIf the optional _wrap_ parameter is +true+, the loaded script will ;TI"Cbe executed under an anonymous module, protecting the calling ;TI"Hprogram's global namespace. If the optional _wrap_ parameter is a ;TI"Hmodule, the loaded script will be executed under the given module. ;TI"GIn no circumstance will any local variables in the loaded file be ;TI"+propagated to the loading environment.;T: @fileI" load.c;T:0@omit_headings_from_table_of_contents_below0I"*load(filename, wrap=false) -> true ;T0[I"(p1, p2 = v2);T@,FI" Kernel;TcRDoc::NormalModule00PK])r~88 trap-i.rinu[U:RDoc::AnyMethod[iI" trap:ETI"Kernel#trap;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"HSpecifies the handling of signals. The first parameter is a signal ;TI"Fname (a string such as ``SIGALRM'', ``SIGUSR1'', and so on) or a ;TI"Csignal number. The characters ``SIG'' may be omitted from the ;TI"Isignal name. The command or block specifies code to be run when the ;TI"signal is raised. ;TI"HIf the command is the string ``IGNORE'' or ``SIG_IGN'', the signal ;TI"will be ignored. ;TI"NIf the command is ``DEFAULT'' or ``SIG_DFL'', the Ruby's default handler ;TI"will be invoked. ;TI"NIf the command is ``EXIT'', the script will be terminated by the signal. ;TI"JIf the command is ``SYSTEM_DEFAULT'', the operating system's default ;TI"handler will be invoked. ;TI"8Otherwise, the given command or block will be run. ;TI"DThe special signal name ``EXIT'' or signal number zero will be ;TI"0invoked just prior to program termination. ;TI" obj Signal.trap( signal ) {| | block } -> obj ;T0[I" (*args);T@+FI" Kernel;TcRDoc::NormalModule00PK]׳DDtap-i.rinu[U:RDoc::AnyMethod[iI"tap:ETI"Kernel#tap;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"6Yields self to the block, and then returns self. ;TI"IThe primary purpose of this method is to "tap into" a method chain, ;TI"Min order to perform operations on intermediate results within the chain.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"@(1..10) .tap {|x| puts "original: #{x}" } ;TI"@ .to_a .tap {|x| puts "array: #{x}" } ;TI"@ .select {|x| x.even? } .tap {|x| puts "evens: #{x}" } ;TI"? .map {|x| x*x } .tap {|x| puts "squares: #{x}" };T: @format0: @fileI"kernel.rb;T:0@omit_headings_from_table_of_contents_below0I"$obj.tap {|x| block } -> obj ;TI" self;T[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]Ԙfee __dir__-i.rinu[U:RDoc::AnyMethod[iI" __dir__:ETI"Kernel#__dir__;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"OReturns the canonicalized absolute path of the directory of the file from ;TI"Mwhich this method is called. It means symlinks in the path is resolved. ;TI"PIf __FILE__ is nil, it returns nil. ;TI"SThe return value equals to File.dirname(File.realpath(__FILE__)).;T: @fileI" eval.c;T:0@omit_headings_from_table_of_contents_below0I"__dir__ -> string ;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00PK]i77 rand-i.rinu[U:RDoc::AnyMethod[iI" rand:ETI"Kernel#rand;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KIf called without an argument, or if max.to_i.abs == 0, rand ;TI"Hreturns a pseudo-random floating point number between 0.0 and 1.0, ;TI"%including 0.0 and excluding 1.0.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"(rand #=> 0.2725926052826416 ;T: @format0o; ; [I"RWhen +max.abs+ is greater than or equal to 1, +rand+ returns a pseudo-random ;TI"Einteger greater than or equal to 0 and less than +max.to_i.abs+.;T@o; ; [I"rand(100) #=> 12 ;T; 0o; ; [I"AWhen +max+ is a Range, +rand+ returns a random number where ;TI"#range.member?(number) == true.;T@o; ; [I"KNegative or floating point values for +max+ are allowed, but may give ;TI"surprising results.;T@o; ; [I"rand(-100) # => 87 ;TI"(rand(-0.5) # => 0.8130921818028143 ;TI";rand(1.9) # equivalent to rand(1), which is always 0 ;T; 0o; ; [I"MKernel.srand may be used to ensure that sequences of random numbers are ;TI"6reproducible between different runs of a program.;T@o; ; [I"See also Random.rand.;T: @fileI" random.c;T:0@omit_headings_from_table_of_contents_below0I"rand(max=0) -> number ;T0[I" (*args);T@/FI" Kernel;TcRDoc::NormalModule00PK] syscall-i.rinu[U:RDoc::AnyMethod[iI" syscall:ETI"Kernel#syscall;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"ACalls the operating system function identified by _num_ and ;TI"Ereturns the result of the function or raises SystemCallError if ;TI"it failed.;To:RDoc::Markup::BlankLineo; ; [ I"FArguments for the function can follow _num_. They must be either ;TI"H+String+ objects or +Integer+ objects. A +String+ object is passed ;TI"Fas a pointer to the byte sequence. An +Integer+ object is passed ;TI"syscall.h.;T@o:RDoc::Markup::Verbatim; [I"?syscall 4, 1, "hello\n", 6 # '4' is write(2) on our box ;T: @format0o; ; [I"produces:;T@o; ; [I" hello ;T; 0o; ; [I"DCalling +syscall+ on a platform which does not have any way to ;TI"Fan arbitrary system function just fails with NotImplementedError.;T@o; ; [ I" *Note:* ;TI"5+syscall+ is essentially unsafe and unportable. ;TI"#Feel free to shoot your foot. ;TI">The DL (Fiddle) library is preferred for safer and a bit ;TI"more portable programming.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"+syscall(num [, args...]) -> integer ;T0[I" (*args);T@1FI" Kernel;TcRDoc::NormalModule00PK]OO open-i.rinu[U:RDoc::AnyMethod[iI" open:ETI"Kernel#open;TF: privateo:RDoc::Markup::Document: @parts[3o:RDoc::Markup::Paragraph; [I"MCreates an IO object connected to the given stream, file, or subprocess.;To:RDoc::Markup::BlankLineo; ; [I"OIf +path+ does not start with a pipe character (|), treat it ;TI"Kas the name of a file to open using the specified mode (defaulting to ;TI" "r").;T@o; ; [ I"KThe +mode+ is either a string or an integer. If it is an integer, it ;TI"Pmust be bitwise-or of open(2) flags, such as File::RDWR or File::EXCL. If ;TI"?it is a string, it is either "fmode", "fmode:ext_enc", or ;TI""fmode:ext_enc:int_enc".;T@o; ; [I"QSee the documentation of IO.new for full documentation of the +mode+ string ;TI"directives.;T@o; ; [I"NIf a file is being created, its initial permissions may be set using the ;TI"P+perm+ parameter. See File.new and the open(2) and chmod(2) man pages for ;TI""a description of permissions.;T@o; ; [I"IIf a block is specified, it will be invoked with the IO object as a ;TI"Gparameter, and the IO will be automatically closed when the block ;TI":terminates. The call returns the value of the block.;T@o; ; [ I"PIf +path+ starts with a pipe character ("|"), a subprocess is ;TI"Kcreated, connected to the caller by a pair of pipes. The returned IO ;TI"Iobject may be used to write to the standard input and read from the ;TI"(standard output of this subprocess.;T@o; ; [ I">If the command following the pipe is a single minus sign ;TI"N("|-"), Ruby forks, and this subprocess is connected to the ;TI"Nparent. If the command is not "-", the subprocess runs the ;TI"Ncommand. Note that the command may be processed by shell if it contains ;TI"shell metacharacters.;T@o; ; [I"LWhen the subprocess is Ruby (opened via "|-"), the +open+ ;TI"Lcall returns +nil+. If a block is associated with the open call, that ;TI"Gblock will run twice --- once in the parent and once in the child.;T@o; ; [I"MThe block parameter will be an IO object in the parent and +nil+ in the ;TI"Mchild. The parent's +IO+ object will be connected to the child's $stdin ;TI"Mand $stdout. The subprocess will be terminated at the end of the block.;T@S:RDoc::Markup::Heading: leveli: textI" Examples;T@o; ; [I"Reading from "testfile":;T@o:RDoc::Markup::Verbatim; [I"open("testfile") do |f| ;TI" print f.gets ;TI" end ;T: @format0o; ; [I"Produces:;T@o;; [I"This is line one ;T;0o; ; [I"+Open a subprocess and read its output:;T@o;; [I"cmd = open("|date") ;TI"print cmd.gets ;TI"cmd.close ;T;0o; ; [I"Produces:;T@o;; [I""Wed Apr 9 08:56:31 CDT 2003 ;T;0o; ; [I"5Open a subprocess running the same Ruby program:;T@o;; [ I"f = open("|-", "w+") ;TI"if f.nil? ;TI" puts "in Child" ;TI" exit ;TI" else ;TI" puts "Got: #{f.gets}" ;TI" end ;T;0o; ; [I"Produces:;T@o;; [I"Got: in Child ;T;0o; ; [I">Open a subprocess using a block to receive the IO object:;T@o;; [I"open "|-" do |f| ;TI" if f then ;TI" # parent process ;TI" puts "Got: #{f.gets}" ;TI" else ;TI" # child process ;TI" puts "in Child" ;TI" end ;TI" end ;T;0o; ; [I"Produces:;T@o;; [I"Got: in Child;T;0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"|open(path [, mode [, perm]] [, opt]) -> io or nil open(path [, mode [, perm]] [, opt]) {|io| block } -> obj ;T0[I" (*args);T@~FI" Kernel;TcRDoc::NormalModule00PK]pR33 sprintf-i.rinu[U:RDoc::AnyMethod[iI" sprintf:ETI"Kernel#sprintf;TF: privateo:RDoc::Markup::Document: @parts[&o:RDoc::Markup::Paragraph; [I"HReturns the string resulting from applying format_string to ;TI"Iany additional arguments. Within the format string, any characters ;TI":other than format sequences are copied to the result.;To:RDoc::Markup::BlankLineo; ; [I"3The syntax of a format sequence is as follows.;T@o:RDoc::Markup::Verbatim; [I"%%[flags][width][.precision]type ;T: @format0o; ; [ I"A format ;TI"Fsequence consists of a percent sign, followed by optional flags, ;TI"Hwidth, and precision indicators, then terminated with a field type ;TI"?character. The field type controls how the corresponding ;TI"Isprintf argument is to be interpreted, while the flags ;TI" modify that interpretation.;T@o; ; [I"#The field type characters are:;T@o; ; [6I"Field | Integer Format ;TI"K------+-------------------------------------------------------------- ;TI"2 b | Convert argument as a binary number. ;TI"F | Negative numbers will be displayed as a two's complement ;TI"" | prefixed with `..1'. ;TI"D B | Equivalent to `b', but uses an uppercase 0B for prefix ;TI"- | in the alternative format by #. ;TI"3 d | Convert argument as a decimal number. ;TI" i | Identical to `d'. ;TI"2 o | Convert argument as an octal number. ;TI"F | Negative numbers will be displayed as a two's complement ;TI"" | prefixed with `..7'. ;TI" u | Identical to `d'. ;TI"7 x | Convert argument as a hexadecimal number. ;TI"F | Negative numbers will be displayed as a two's complement ;TI"E | prefixed with `..f' (representing an infinite string of ;TI" | leading 'ff's). ;TI"< X | Equivalent to `x', but uses uppercase letters. ;TI" ;TI"Field | Float Format ;TI"K------+-------------------------------------------------------------- ;TI"G e | Convert floating point argument into exponential notation ;TI"L | with one digit before the decimal point as [-]d.dddddde[+-]dd. ;TI"L | The precision specifies the number of digits after the decimal ;TI"( | point (defaulting to six). ;TI"D E | Equivalent to `e', but uses an uppercase E to indicate ;TI" | the exponent. ;TI"? f | Convert floating point argument as [-]ddd.dddddd, ;TI"F | where the precision specifies the number of digits after ;TI" | the decimal point. ;TI"D g | Convert a floating point number using exponential form ;TI"@ | if the exponent is less than -4 or greater than or ;TI"C | equal to the precision, or in dd.dddd form otherwise. ;TI"G | The precision specifies the number of significant digits. ;TI"K G | Equivalent to `g', but use an uppercase `E' in exponent form. ;TI"D a | Convert floating point argument as [-]0xh.hhhhp[+-]dd, ;TI"H | which is consisted from optional sign, "0x", fraction part ;TI"C | as hexadecimal, "p", and exponential part as decimal. ;TI"? A | Equivalent to `a', but use uppercase `X' and `P'. ;TI" ;TI"Field | Other Format ;TI"K------+-------------------------------------------------------------- ;TI"D c | Argument is the numeric code for a single character or ;TI"/ | a single character string itself. ;TI". p | The valuing of argument.inspect. ;TI"D s | Argument is a string to be substituted. If the format ;TI"I | sequence contains a precision, at most that many characters ;TI" | will be copied. ;TI"J % | A percent sign itself will be displayed. No argument taken. ;T; 0o; ; [I"5The flags modifies the behavior of the formats. ;TI"The flag characters are:;T@o; ; [/I"(Flag | Applies to | Meaning ;TI"I---------+---------------+----------------------------------------- ;TI">space | bBdiouxX | Leave a space at the start of ;TI"6 | aAeEfgG | non-negative numbers. ;TI"D | (numeric fmt) | For `o', `x', `X', `b' and `B', use ;TI"E | | a minus sign with absolute value for ;TI"1 | | negative values. ;TI"I---------+---------------+----------------------------------------- ;TI"G(digit)$ | all | Specifies the absolute argument number ;TI"G | | for this field. Absolute and relative ;TI"F | | argument numbers cannot be mixed in a ;TI"0 | | sprintf string. ;TI"I---------+---------------+----------------------------------------- ;TI"; # | bBoxX | Use an alternative format. ;TI"P | aAeEfgG | For the conversions `o', increase the precision ;TI"E | | until the first digit will be `0' if ;TI"D | | it is not formatted as complements. ;TI"J | | For the conversions `x', `X', `b' and `B' ;TI"L | | on non-zero, prefix the result with ``0x'', ;TI"I | | ``0X'', ``0b'' and ``0B'', respectively. ;TI"K | | For `a', `A', `e', `E', `f', `g', and 'G', ;TI"C | | force a decimal point to be added, ;TI": | | even if no digits follow. ;TI"O | | For `g' and 'G', do not remove trailing zeros. ;TI"I---------+---------------+----------------------------------------- ;TI"H+ | bBdiouxX | Add a leading plus sign to non-negative ;TI") | aAeEfgG | numbers. ;TI"D | (numeric fmt) | For `o', `x', `X', `b' and `B', use ;TI"E | | a minus sign with absolute value for ;TI"1 | | negative values. ;TI"I---------+---------------+----------------------------------------- ;TI"L- | all | Left-justify the result of this conversion. ;TI"I---------+---------------+----------------------------------------- ;TI"<0 (zero) | bBdiouxX | Pad with zeros, not spaces. ;TI"H | aAeEfgG | For `o', `x', `X', `b' and `B', radix-1 ;TI"J | (numeric fmt) | is used for negative numbers formatted as ;TI"- | | complements. ;TI"I---------+---------------+----------------------------------------- ;TI"J* | all | Use the next argument as the field width. ;TI"M | | If negative, left-justify the result. If the ;TI"N | | asterisk is followed by a number and a dollar ;TI"O | | sign, use the indicated argument as the width. ;T; 0o; ; [I"Examples of flags:;T@o; ; [:I"F# `+' and space flag specifies the sign of non-negative numbers. ;TI"#sprintf("%d", 123) #=> "123" ;TI"$sprintf("%+d", 123) #=> "+123" ;TI"$sprintf("% d", 123) #=> " 123" ;TI" ;TI"@# `#' flag for `o' increases number of digits to show `0'. ;TI"># `+' and space flag changes format of negative numbers. ;TI"$sprintf("%o", 123) #=> "173" ;TI"%sprintf("%#o", 123) #=> "0173" ;TI"%sprintf("%+o", -123) #=> "-173" ;TI"'sprintf("%o", -123) #=> "..7605" ;TI"'sprintf("%#o", -123) #=> "..7605" ;TI" ;TI"@# `#' flag for `x' add a prefix `0x' for non-zero numbers. ;TI"E# `+' and space flag disables complements for negative numbers. ;TI"#sprintf("%x", 123) #=> "7b" ;TI"%sprintf("%#x", 123) #=> "0x7b" ;TI"$sprintf("%+x", -123) #=> "-7b" ;TI"&sprintf("%x", -123) #=> "..f85" ;TI"(sprintf("%#x", -123) #=> "0x..f85" ;TI""sprintf("%#x", 0) #=> "0" ;TI" ;TI")# `#' for `X' uses the prefix `0X'. ;TI""sprintf("%X", 123) #=> "7B" ;TI"$sprintf("%#X", 123) #=> "0X7B" ;TI" ;TI"@# `#' flag for `b' add a prefix `0b' for non-zero numbers. ;TI"E# `+' and space flag disables complements for negative numbers. ;TI"(sprintf("%b", 123) #=> "1111011" ;TI"*sprintf("%#b", 123) #=> "0b1111011" ;TI")sprintf("%+b", -123) #=> "-1111011" ;TI"+sprintf("%b", -123) #=> "..10000101" ;TI"-sprintf("%#b", -123) #=> "0b..10000101" ;TI""sprintf("%#b", 0) #=> "0" ;TI" ;TI")# `#' for `B' uses the prefix `0B'. ;TI"'sprintf("%B", 123) #=> "1111011" ;TI")sprintf("%#B", 123) #=> "0B1111011" ;TI" ;TI"5# `#' for `e' forces to show the decimal point. ;TI"%sprintf("%.0e", 1) #=> "1e+00" ;TI"&sprintf("%#.0e", 1) #=> "1.e+00" ;TI" ;TI"5# `#' for `f' forces to show the decimal point. ;TI"'sprintf("%.0f", 1234) #=> "1234" ;TI"(sprintf("%#.0f", 1234) #=> "1234." ;TI" ;TI"5# `#' for `g' forces to show the decimal point. ;TI"0# It also disables stripping lowest zeros. ;TI"(sprintf("%g", 123.4) #=> "123.4" ;TI"*sprintf("%#g", 123.4) #=> "123.400" ;TI")sprintf("%g", 123456) #=> "123456" ;TI"*sprintf("%#g", 123456) #=> "123456." ;T; 0o; ; [I"FThe field width is an optional integer, followed optionally by a ;TI"Hperiod and a precision. The width specifies the minimum number of ;TI"Bcharacters that will be written to the result for this field.;T@o; ; [I"Examples of width:;T@o; ; [I"1# padding is done by spaces, width=20 ;TI"6# 0 or radix-1. <------------------> ;TI"7sprintf("%20d", 123) #=> " 123" ;TI"7sprintf("%+20d", 123) #=> " +123" ;TI"7sprintf("%020d", 123) #=> "00000000000000000123" ;TI"7sprintf("%+020d", 123) #=> "+0000000000000000123" ;TI"7sprintf("% 020d", 123) #=> " 0000000000000000123" ;TI"7sprintf("%-20d", 123) #=> "123 " ;TI"7sprintf("%-+20d", 123) #=> "+123 " ;TI"7sprintf("%- 20d", 123) #=> " 123 " ;TI"7sprintf("%020x", -123) #=> "..ffffffffffffffff85" ;T; 0o; ; [ I" For ;TI"Inumeric fields, the precision controls the number of decimal places ;TI"Idisplayed. For string fields, the precision determines the maximum ;TI"Knumber of characters to be copied from the string. (Thus, the format ;TI"Fsequence %10.10s will always contribute exactly ten ;TI"characters to the result.);T@o; ; [I"Examples of precisions:;T@o; ; [-I".# precision for `d', 'o', 'x' and 'b' is ;TI"7# minimum number of digits <------> ;TI"8sprintf("%20.8d", 123) #=> " 00000123" ;TI"8sprintf("%20.8o", 123) #=> " 00000173" ;TI"8sprintf("%20.8x", 123) #=> " 0000007b" ;TI"8sprintf("%20.8b", 123) #=> " 01111011" ;TI"8sprintf("%20.8d", -123) #=> " -00000123" ;TI"8sprintf("%20.8o", -123) #=> " ..777605" ;TI"8sprintf("%20.8x", -123) #=> " ..ffff85" ;TI"8sprintf("%20.8b", -11) #=> " ..110101" ;TI" ;TI":# "0x" and "0b" for `#x' and `#b' is not counted for ;TI"8# precision but "0" for `#o' is counted. <------> ;TI"9sprintf("%#20.8d", 123) #=> " 00000123" ;TI"9sprintf("%#20.8o", 123) #=> " 00000173" ;TI"9sprintf("%#20.8x", 123) #=> " 0x0000007b" ;TI"9sprintf("%#20.8b", 123) #=> " 0b01111011" ;TI"9sprintf("%#20.8d", -123) #=> " -00000123" ;TI"9sprintf("%#20.8o", -123) #=> " ..777605" ;TI"9sprintf("%#20.8x", -123) #=> " 0x..ffff85" ;TI"9sprintf("%#20.8b", -11) #=> " 0b..110101" ;TI" ;TI"&# precision for `e' is number of ;TI"9# digits after the decimal point <------> ;TI">sprintf("%20.8e", 1234.56789) #=> " 1.23456789e+03" ;TI" ;TI"&# precision for `f' is number of ;TI"=# digits after the decimal point <------> ;TI">sprintf("%20.8f", 1234.56789) #=> " 1234.56789000" ;TI" ;TI"&# precision for `g' is number of ;TI"=# significant digits <-------> ;TI">sprintf("%20.8g", 1234.56789) #=> " 1234.5679" ;TI" ;TI"9# <-------> ;TI">sprintf("%20.8g", 123456789) #=> " 1.2345679e+08" ;TI" ;TI"# precision for `s' is ;TI"@# maximum number of characters <------> ;TI"Asprintf("%20.8s", "string test") #=> " string t" ;T; 0o; ; [I"Examples:;T@o; ; [ I"?sprintf("%d %04x", 123, 123) #=> "123 007b" ;TI"Fsprintf("%08b '%4s'", 123, 123) #=> "01111011 ' 123'" ;TI"Gsprintf("%1$*2$s %2$d %1$s", "hello", 8) #=> " hello 8 hello" ;TI"Bsprintf("%1$*2$s %2$d", "hello", -8) #=> "hello -8" ;TI"Gsprintf("%+g:% g:%-g", 1.23, 1.23, 1.23) #=> "+1.23: 1.23:1.23" ;TI";sprintf("%u", -123) #=> "-123" ;T; 0o; ; [I"EFor more complex formatting, Ruby supports a reference by name. ;TI"A%s style uses format style, but %{name} style doesn't.;T@o; ; [I"Examples:;To; ; [ I"d : %f", { :foo => 1, :bar => 2 }) ;TI" #=> 1 : 2.000000 ;TI"'sprintf("%{foo}f", { :foo => 1 }) ;TI" # => "1f";T; 0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"mformat(format_string [, arguments...] ) -> string sprintf(format_string [, arguments...] ) -> string ;T0[[I" format;T@ I" (*args);T@FI" Kernel;TcRDoc::NormalModule00PK]%!!pretty_inspect-i.rinu[PK]SXG~~ dfork-i.rinu[PK]F; :: raise-i.rinu[PK] `` Rational-i.rinu[PK]PKB ,Hash-i.rinu[PK]C,3,3 format-i.rinu[PK]O1 ^Keval-i.rinu[PK]' DOreadline-i.rinu[PK]55 DQsystem-i.rinu[PK]+== Ywarn-i.rinu[PK]/m *aprint-i.rinu[PK]D   ?ecaller-i.rinu[PK]֢doo kthrow-i.rinu[PK] ٕ ,nfail-i.rinu[PK]˫ѧ sloop-i.rinu[PK]Rxx wFloat-i.rinu[PK]F |chop-i.rinu[PK]Yvl55~URI-c.rinu[PK]Qe*44URI-i.rinu[PK]8b ^puts-i.rinu[PK]/UV..%gem_original_require-i.rinu[PK]jǥ*  yield_self-i.rinu[PK]pgg callcc-i.rinu[PK]IIIcaller_locations-i.rinu[PK]lVBB at_exit-i.rinu[PK]|global_variables-i.rinu[PK],Z Array-i.rinu[PK]2 pexit%21-i.rinu[PK]'%Ü%60-i.rinu[PK]  Ɵset_trace_func-i.rinu[PK],Zww "Complex-i.rinu[PK])Z XXկiterator%3f-i.rinu[PK]} mputc-i.rinu[PK]\0 0 BigDecimal-i.rinu[PK][gDD srand-i.rinu[PK]`p-i.rinu[PK]\# jlambda-i.rinu[PK]fll Cselect-i.rinu[PK]cc String-i.rinu[PK]5"  block_given%3f-i.rinu[PK]sS binding-i.rinu[PK]0LAfrozen%3f-i.rinu[PK]ُb +Pathname-i.rinu[PK]   Uprintf-i.rinu[PK]K chomp-i.rinu[PK]ݴiautoload%3f-i.rinu[PK]Ϙ]local_variables-i.rinu[PK]LU Sabort-i.rinu[PK]VäLLsy-i.rinu[PK]b`` Integer-i.rinu[PK]3[͜22 spawn-i.rinu[PK]Z=~~g4jj-i.rinu[PK]#yy6trace_var-i.rinu[PK]X4]:pp-i.rinu[PK]f9İ>> M<proc-i.rinu[PK]AVM77 =class-i.rinu[PK]~W5@pp-c.rinu[PK]"krr &Bgets-i.rinu[PK]nNN Hthen-i.rinu[PK]C XMexec-i.rinu[PK]5 ,\JSON-i.rinu[PK]8APf^__method__-i.rinu[PK]= 66`untrace_var-i.rinu[PK] mmbcj-i.rinu[PK]0J esleep-i.rinu[PK]ěhreadlines-i.rinu[PK]i} jgsub-i.rinu[PK]O0 (mclone-i.rinu[PK]bB7>rsub-i.rinu[PK](|t__callee__-i.rinu[PK]fvgem-i.rinu[PK]'4;0PP w}autoload-i.rinu[PK]˅ !  test-i.rinu[PK]M@@ @catch-i.rinu[PK]- exit-i.rinu[PK]1{OO ƙrequire-i.rinu[PK]&A''Qrequire_relative-i.rinu[PK]{8@55cdesc-Kernel.rinu[PK]@AnI load-i.rinu[PK])r~88 trap-i.rinu[PK]׳DD+tap-i.rinu[PK]Ԙfee __dir__-i.rinu[PK]i77 Hrand-i.rinu[PK] syscall-i.rinu[PK]OO open-i.rinu[PK]pR33 tsprintf-i.rinu[PKVVXI<