ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
pretty_inspect-i.ri 0000644 00000001040 15237607405 0010406 0 ustar 00 U:RDoc::AnyMethod[iI"pretty_inspect:EFI"Kernel#pretty_inspect;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"1Returns a pretty printed object as a string.;To:RDoc::Markup::BlankLine o;
; [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::NormalModule00 fork-i.ri 0000644 00000002650 15237607405 0006303 0 ustar 00 U:RDoc::AnyMethod[iI" fork:ETI"Kernel#fork;TF:publico: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"=zero. Otherwise, the +fork+ call returns twice, once in ;TI"Dthe parent, returning the process ID of the child, and once in ;TI"Bthe child, returning _nil_. The child process can exit using ;TI"4Kernel.exit! to avoid running any ;TI"?at_exit functions. The parent process should ;TI"Guse Process.wait to collect the termination statuses ;TI"Dof its children or use Process.detach to register ;TI"Bdisinterest in their status; otherwise, the operating system ;TI"%may accumulate zombie processes.;To:RDoc::Markup::BlankLine o;
; [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"TNote that fork(2) is not avaiable 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 }] -> fixnum or nil
Process.fork [{ block }] -> fixnum or nil
;T0[ I"();T@$FI"Kernel;TcRDoc::NormalModule00 raise-i.ri 0000644 00000002156 15237607405 0006446 0 ustar 00 U:RDoc::AnyMethod[iI"
raise:ETI"Kernel#raise;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JWith no arguments, raises the exception in $! or raises ;TI">a RuntimeError if $! is +nil+. ;TI"/With a single +String+ argument, raises a ;TI"=+RuntimeError+ with the string as a message. Otherwise, ;TI">the first parameter should be the name of an +Exception+ ;TI"Fclass (or an object that returns an +Exception+ object when sent ;TI"Ean +exception+ message). The optional second parameter sets the ;TI"Jmessage associated with the exception, and the third parameter is an ;TI"Aarray of callback information. Exceptions are caught by the ;TI"8+rescue+ clause of begin...end blocks.;To:RDoc::Markup::BlankLine 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)
raise(exception [, string [, array]]);T0[ I"(*args);T@FI"Kernel;TcRDoc::NormalModule00 Rational-i.ri 0000644 00000002262 15237607405 0007112 0 ustar 00 U:RDoc::AnyMethod[iI"
Rational:ETI"Kernel#Rational;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"Returns x/y;;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I" Rational(1, 2) #=> (1/2)
;TI" Rational('1/2') #=> (1/2)
;TI"$Rational(nil) #=> TypeError
;TI"$Rational(1, nil) #=> TypeError
;T:@format0o;
; [I"Syntax of string form:;T@o;; [I" numeric
;T0[ I"(*args);T@(FI"Kernel;TcRDoc::NormalModule00 Hash-i.ri 0000644 00000001253 15237607405 0006223 0 ustar 00 U:RDoc::AnyMethod[iI" Hash:ETI"Kernel#Hash;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I";Converts arg to a Hash by calling ;TI"Narg.to_hash. Returns an empty Hash when ;TI"/arg is nil or [].;To:RDoc::Markup::BlankLine o: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::NormalModule00 format-i.ri 0000644 00000031515 15237607405 0006634 0 ustar 00 U:RDoc::AnyMethod[iI"format:ETI"Kernel#format;TF:publico:RDoc::Markup::Document:@parts[&o:RDoc::Markup::Paragraph; [I"HReturns the string resulting from applying format_string to ;FI"Iany additional arguments. Within the format string, any characters ;FI":other than format sequences are copied to the result.;Fo:RDoc::Markup::BlankLine o;
; [I"0The syntax of a format sequence is follows.;F@o:RDoc::Markup::Verbatim; [I"%%[flags][width][.precision]type
;T:@format0o;
; [I"A format ;FI"Fsequence consists of a percent sign, followed by optional flags, ;FI"Hwidth, and precision indicators, then terminated with a field type ;FI"?character. The field type controls how the corresponding ;FI"Isprintf argument is to be interpreted, while the flags ;FI" modify that interpretation.;F@o;
; [I"#The field type characters are:;F@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. ;FI"The flag characters are:;F@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:;F@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 ;FI"Hperiod and a precision. The width specifies the minimum number of ;FI"Bcharacters that will be written to the result for this field.;F@o;
; [I"Examples of width:;F@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 ;FI"Inumeric fields, the precision controls the number of decimal places ;FI"Idisplayed. For string fields, the precision determines the maximum ;FI"Knumber of characters to be copied from the string. (Thus, the format ;FI"Fsequence %10.10s will always contribute exactly ten ;FI"characters to the result.);F@o;
; [I"Examples of precisions:;F@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:;F@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. ;FI"A%s style uses format style, but %{name} style doesn't.;F@o;
; [I"Examples:;Fo;; [ 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"8format(format_string [, arguments...] ) -> string;F0[ I"(*args);T@FI"Kernel;TcRDoc::NormalModule00 eval-i.ri 0000644 00000001671 15237607405 0006273 0 ustar 00 U:RDoc::AnyMethod[iI" eval:ETI"Kernel#eval;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [
I"=Evaluates the Ruby expression(s) in string. If ;TI"Ebinding is given, which must be a Binding ;TI"@object, the evaluation is performed in its context. If the ;TI"Coptional filename and lineno parameters are ;TI"=present, they will be used when reporting syntax errors.;To:RDoc::Markup::BlankLine o: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::NormalModule00 readline-i.ri 0000644 00000000717 15237607405 0007127 0 ustar 00 U:RDoc::AnyMethod[iI"
readline:ETI"Kernel#readline;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"5Equivalent 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::NormalModule00 system-i.ri 0000644 00000002652 15237607405 0006670 0 ustar 00 U:RDoc::AnyMethod[iI"system:ETI"Kernel#system;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"*Executes _command..._ in a subshell. ;TI",_command..._ is one of following forms.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"]commandline : command line string which is passed to the standard shell
;TI"Ucmdname, arg1, ... : command name and one or more arguments (no shell)
;TI"_[cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
;T:@format0o;
; [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"6An error status is available in $?. ;TI"4The arguments are processed in the same way as ;TI"#for Kernel.spawn.;T@o;
; [I"6The hash arguments, env and options, are same as ;TI"/exec and spawn. ;TI"/See Kernel.spawn for details.;T@o;; [I"system("echo *")
;TI"system("echo", "*")
;T;
0o;
; [I"produces:;T@o;; [I"config.h main.rb
;TI"*
;T;
0o;
; [I"9See Kernel.exec for the standard shell.;T:
@fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I"Csystem([env,] command... [,options]) -> true, false or nil
;T0[ I"(*args);T@0FI"Kernel;TcRDoc::NormalModule00 warn-i.ri 0000644 00000001207 15237607405 0006306 0 ustar 00 U:RDoc::AnyMethod[iI" warn:ETI"Kernel#warn;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"KDisplays each of the given messages followed by a record separator on ;TI"ESTDERR unless warnings have been disabled (for example with the ;TI"-W0 flag).;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"& warn("warning 1", "warning 2")
;TI"
;TI"produces:
;TI"
;TI" warning 1
;TI" warning 2;T:@format0:
@fileI"error.c;T:0@omit_headings_from_table_of_contents_below0I"warn(msg, ...) -> nil
;T0[ I"(*args);T@FI"Kernel;TcRDoc::NormalModule00 print-i.ri 0000644 00000001732 15237607405 0006476 0 ustar 00 U:RDoc::AnyMethod[iI"
print:ETI"Kernel#print;TF:publico: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::BlankLine o: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::NormalModule00 caller-i.ri 0000644 00000003010 15237607405 0006573 0 ustar 00 U:RDoc::AnyMethod[iI"caller:ETI"Kernel#caller;TF:publico: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::BlankLine 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@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::NormalModule00 throw-i.ri 0000644 00000001166 15237607405 0006506 0 ustar 00 U:RDoc::AnyMethod[iI"
throw:ETI"Kernel#throw;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I">Transfers control to the end of the active +catch+ block ;TI"8waiting for _tag_. Raises +ArgumentError+ 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::NormalModule00 fail-i.ri 0000644 00000002151 15237607405 0006251 0 ustar 00 U:RDoc::AnyMethod[iI" fail:ETI"Kernel#fail;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JWith no arguments, raises the exception in $! or raises ;TI">a RuntimeError if $! is +nil+. ;TI"/With a single +String+ argument, raises a ;TI"=+RuntimeError+ with the string as a message. Otherwise, ;TI">the first parameter should be the name of an +Exception+ ;TI"Fclass (or an object that returns an +Exception+ object when sent ;TI"Ean +exception+ message). The optional second parameter sets the ;TI"Jmessage associated with the exception, and the third parameter is an ;TI"Aarray of callback information. Exceptions are caught by the ;TI"8+rescue+ clause of begin...end blocks.;To:RDoc::Markup::BlankLine 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";fail
fail(string)
fail(exception [, string [, array]]);T0[ I"(*args);T@FI"Kernel;TcRDoc::NormalModule00 loop-i.ri 0000644 00000001242 15237607405 0006307 0 ustar 00 U:RDoc::AnyMethod[iI" loop:ETI"Kernel#loop;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"#Repeatedly executes the block.;To:RDoc::Markup::BlankLine o;
; [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"7StopIteration raised in the block breaks the loop.;T:
@fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I"5loop { block }
loop -> an_enumerator
;T0[ I"();T@FI"Kernel;TcRDoc::NormalModule00 Float-i.ri 0000644 00000001165 15237607405 0006407 0 ustar 00 U:RDoc::AnyMethod[iI"
Float:ETI"Kernel#Float;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JReturns arg converted to a float. Numeric types are converted ;TI"=directly, the rest are converted using arg.to_f. ;TI"DConverting nil generates a TypeError.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I" Float(1) #=> 1.0
;TI"#Float("123.456") #=> 123.456;T:@format0:
@fileI"
object.c;T:0@omit_headings_from_table_of_contents_below0I"Float(arg) -> float
;T0[ I" (p1);T@FI"Kernel;TcRDoc::NormalModule00 chop-i.ri 0000644 00000000714 15237607405 0006272 0 ustar 00 U:RDoc::AnyMethod[iI" chop:ETI"Kernel#chop;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HEquivalent to ($_.dup).chop!, except nil ;TI"7is 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::NormalModule00 URI-c.ri 0000644 00000000465 15237607405 0005775 0 ustar 00 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::NormalModule00 URI-i.ri 0000644 00000000464 15237607405 0006002 0 ustar 00 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::NormalModule00 puts-i.ri 0000644 00000000615 15237607405 0006334 0 ustar 00 U:RDoc::AnyMethod[iI" puts:ETI"Kernel#puts;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"Equivalent to;To:RDoc::Markup::BlankLine o: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::NormalModule00 gem_original_require-i.ri 0000644 00000000610 15237607405 0011524 0 ustar 00 U:RDoc::AnyMethod[iI"gem_original_require:EFI" Kernel#gem_original_require;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"8The Kernel#require from before RubyGems was loaded.;T:
@fileI",lib/rubygems/core_ext/kernel_require.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(path);T@FI"Kernel;TcRDoc::NormalModule0[@FI"require;F yield_self-i.ri 0000644 00000001414 15237607405 0007456 0 ustar 00 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::BlankLine o: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::NormalModule00 callcc-i.ri 0000644 00000001546 15237607405 0006566 0 ustar 00 U:RDoc::AnyMethod[iI"callcc:ETI"Kernel#callcc;TF:publico: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::NormalModule00 caller_locations-i.ri 0000644 00000002110 15237607405 0010646 0 ustar 00 U:RDoc::AnyMethod[iI"caller_locations:ETI"Kernel#caller_locations;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"?Returns the current execution stack---an array containing ;TI" backtrace location objects.;To:RDoc::Markup::BlankLine o;
; [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::NormalModule00 at_exit-i.ri 0000644 00000001501 15237607405 0006771 0 ustar 00 U:RDoc::AnyMethod[iI"at_exit:ETI"Kernel#at_exit;TF:publico: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::BlankLine o: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::NormalModule00 global_variables-i.ri 0000644 00000000764 15237607405 0010636 0 ustar 00 U:RDoc::AnyMethod[iI"global_variables:ETI"Kernel#global_variables;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7Returns an array of the names of global variables.;Fo:RDoc::Markup::BlankLine o: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
;F0[ I"();T@FI"Kernel;TcRDoc::NormalModule00 Array-i.ri 0000644 00000001000 15237607405 0006404 0 ustar 00 U:RDoc::AnyMethod[iI"
Array:ETI"Kernel#Array;TF:publico:RDoc::Markup::Document:@parts[
o:RDoc::Markup::Paragraph; [I"Returns +arg+ as an Array.;To:RDoc::Markup::BlankLine o;
; [I"NFirst tries to call to_ary on +arg+, then to_a.;T@o:RDoc::Markup::Verbatim; [I"&Array(1..5) #=> [1, 2, 3, 4, 5];T:@format0:
@fileI"
object.c;T:0@omit_headings_from_table_of_contents_below0I"Array(arg) -> array
;T0[ I" (p1);T@FI"Kernel;TcRDoc::NormalModule00exit%21-i.ri 0000644 00000001030 15237607405 0006512 0 ustar 00 U:RDoc::AnyMethod[iI"
exit!:ETI"Kernel#exit!;TF:publico: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::BlankLine o: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"(p1 = v1);T@FI"Kernel;TcRDoc::NormalModule00 %60-i.ri 0000644 00000001312 15237607405 0005626 0 ustar 00 U:RDoc::AnyMethod[iI"`:ETI"
Kernel#`;TF:publico: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::BlankLine o: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::NormalModule00 set_trace_func-i.ri 0000644 00000004634 15237607405 0010332 0 ustar 00 U:RDoc::AnyMethod[iI"set_trace_func:ETI"Kernel#set_trace_func;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"@Establishes _proc_ as the handler for tracing, or disables ;TI"'tracing if the parameter is +nil+.;To:RDoc::Markup::BlankLine o;
; [I"D*Note:* this method is obsolete, please use TracePoint instead.;T@o;
; [I"'_proc_ takes up to six parameters:;T@o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o;
; [I"an event name;To;;0; [o;
; [I"a filename;To;;0; [o;
; [I"a line number;To;;0; [o;
; [I"an object id;To;;0; [o;
; [I"a binding;To;;0; [o;
; [I"the name of a class;T@o;
; [I"0_proc_ is invoked whenever an event occurs.;T@o;
; [I"Events are:;T@o;;
: NOTE;[
o;;[I"
+c-call+;T; [o;
; [I"call a C-language routine;To;;[I"+c-return+;T; [o;
; [I"%return from a C-language routine;To;;[I"+call+;T; [o;
; [I"call a Ruby method;To;;[I"+class+;T; [o;
; [I")start a class or module definition),;To;;[I"
+end+;T; [o;
; [I"*finish a class or module definition),;To;;[I"+line+;T; [o;
; [I"execute code on a new line;To;;[I"+raise+;T; [o;
; [I"raise an exception;To;;[I"
+return+;T; [o;
; [I"return from a Ruby method;T@o;
; [I"6Tracing is disabled within the context of _proc_.;T@o:RDoc::Markup::Verbatim; [I" class Test
;TI" def test
;TI" a = 1
;TI" b = 2
;TI" end
;TI" end
;TI"
;TI"I set_trace_func proc { |event, file, line, id, binding, classname|
;TI"L 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:@format0:
@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@FI"Kernel;TcRDoc::NormalModule00 Complex-i.ri 0000644 00000002743 15237607405 0006754 0 ustar 00 U:RDoc::AnyMethod[iI"Complex:ETI"Kernel#Complex;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"Returns x+i*y;;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"!Complex(1, 2) #=> (1+2i)
;TI"!Complex('1+2i') #=> (1+2i)
;TI"$Complex(nil) #=> TypeError
;TI"$Complex(1, nil) #=> TypeError
;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]) -> numeric
;T0[ I"(*args);T@.FI"Kernel;TcRDoc::NormalModule00 iterator%3f-i.ri 0000644 00000001403 15237607405 0007464 0 ustar 00 U:RDoc::AnyMethod[iI"iterator?:ETI"Kernel#iterator?;TF:publico: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::BlankLine o: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"$iterator? -> true or false;T0[ I"();T@FI"Kernel;TcRDoc::NormalModule00 putc-i.ri 0000644 00000000740 15237607405 0006313 0 ustar 00 U:RDoc::AnyMethod[iI" putc:ETI"Kernel#putc;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Verbatim; [I"Equivalent to:
;TI"
;TI" $stdout.putc(int)
;T:@format0o:RDoc::Markup::Paragraph; [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::NormalModule00 BigDecimal-i.ri 0000644 00000000527 15237607405 0007323 0 ustar 00 U:RDoc::AnyMethod[iI"BigDecimal:ETI"Kernel#BigDecimal;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"See also BigDecimal::new;To:RDoc::Markup::BlankLine :
@fileI" ext/bigdecimal/bigdecimal.c;T:0@omit_headings_from_table_of_contents_below000[ I"(*args);T@FI"Kernel;TcRDoc::NormalModule00 srand-i.ri 0000644 00000002527 15237607405 0006454 0 ustar 00 U:RDoc::AnyMethod[iI"
srand:ETI"Kernel#srand;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"LSeeds the system pseudo-random number generator, Random::DEFAULT, with ;TI"4+number+. The previous seed value is returned.;To:RDoc::Markup::BlankLine o;
; [ 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"(p1 = v1);T@"FI"Kernel;TcRDoc::NormalModule00 p-i.ri 0000644 00000001247 15237607405 0005602 0 ustar 00 U:RDoc::AnyMethod[iI"p:ETI"
Kernel#p;TF:publico: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::BlankLine o: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::NormalModule00 lambda-i.ri 0000644 00000000652 15237607405 0006562 0 ustar 00 U:RDoc::AnyMethod[iI"lambda:ETI"Kernel#lambda;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"LEquivalent to Proc.new, except the resulting Proc objects ;TI"7check the 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::NormalModule00 select-i.ri 0000644 00000014760 15237607405 0006626 0 ustar 00 U:RDoc::AnyMethod[iI"select:ETI"Kernel#select;TF:publico:RDoc::Markup::Document:@parts[-o:RDoc::Markup::Paragraph; [I""Calls select(2) system call. ;TI"LIt monitors given arrays of IO objects, waits one or more ;TI"Jof IO objects ready for reading, are ready for writing, ;TI"Iand have pending exceptions respectively, and returns an array that ;TI"Kcontains arrays of those IO objects. It will return nil ;TI"Mif optional timeout value is given and no IO object ;TI"(is ready in timeout seconds.;To:RDoc::Markup::BlankLine o;
; [
I"aIO.select peeks the buffer of IO objects for testing readability. ;TI"1If the IO buffer is not empty, ;TI"<IO.select immediately notify readability. ;TI"=This "peek" is only happen for IO objects. ;TI"JIt is not happen for IO-like objects such as OpenSSL::SSL::SSLSocket.;T@o;
; [I"?The best way to use IO.select is invoking it ;TI"eafter nonblocking methods such as read_nonblock, write_nonblock, etc. ;TI":The methods raises an exception which is extended by ;TI"EIO::WaitReadable or IO::WaitWritable. ;TI"PThe modules notify how the caller should wait with IO.select. ;TI"UIf IO::WaitReadable is raised, the caller should wait for reading. ;TI"TIf IO::WaitWritable is raised, the caller should wait for writing.;T@o;
; [I"HSo, blocking read (readpartial) can be emulated using ;TI"Fread_nonblock and IO.select as follows:;T@o:RDoc::Markup::Verbatim; [I"begin
;TI". result = io_like.read_nonblock(maxlen)
;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
;T:@format0o;
; [
I"IO.select is preferred for IO like ;TI";objects such as OpenSSL::SSL::SSLSocket. ;TI"SIt has to_io method to return underlying IO object. ;TI"[IO.select calls to_io to obtain the file descriptor to wait.;T@o;
; [I"QThis means that readability notified by IO.select doesn't mean ;TI"Breadability from OpenSSL::SSL::SSLSocket object.;T@o;
; [I"XMost possible situation is OpenSSL::SSL::SSLSocket buffers some data. ;TI"4IO.select doesn't see the buffer. ;TI"mSo IO.select can block when OpenSSL::SSL::SSLSocket#readpartial doesn't block.;T@o;
; [I"7However several more complicated situation exists.;T@o;
; [I"5SSL is a protocol which is sequence of records. ;TI")The record consists multiple bytes. ;TI"8So, the remote side of SSL sends a partial record, ;TI"5IO.select notifies readability but ;TI"DOpenSSL::SSL::SSLSocket cannot decrypt a byte and ;TI"BOpenSSL::SSL::SSLSocket#readpartial will blocks.;T@o;
; [I"FAlso, the remote side can request SSL renegotiation which forces ;TI",the local SSL engine writes some data. ;TI"EThis means OpenSSL::SSL::SSLSocket#readpartial may ;TI"=invoke write system call and it can block. ;TI"KIn such situation, OpenSSL::SSL::SSLSocket#read_nonblock ;TI"2raises IO::WaitWritable instead of blocking. ;TI"KSo, the caller should wait for ready for writability as above example.;T@o;
; [I"JThe combination of nonblocking methods and IO.select is ;TI"Balso useful for streams such as tty, pipe socket socket when ;TI")multiple process read form a stream.;T@o;
; [ I"=Finally, Linux kernel developers doesn't guarantee that ;TI"Jreadability of select(2) means readability of following read(2) even ;TI"for single process. ;TI".See select(2) manual on GNU/Linux system.;T@o;
; [I"]Invoking IO.select before IO#readpartial works well in usual. ;TI"BHowever it is not the best way to use IO.select.;T@o;
; [
I"8The writability notified by select(2) doesn't show ;TI"how many bytes writable. ;TI"NIO#write method blocks until given whole string is written. ;TI"uSo, IO#write(two or more bytes) can block after writability is notified by IO.select. ;TI"FIO#write_nonblock is required to avoid the blocking.;T@o;
; [I"?Blocking write (write) can be emulated using ;TI"Hwrite_nonblock and IO.select as follows: ;TI"kIO::WaitReadable should also be rescued for SSL 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"Gan array of IO objects that wait until ready for read;To;;[I"write_array;T; [o;
; [I"Han array of IO objects that wait until ready for write;To;;[I"error_array;T; [o;
; [I"Aan 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"YIO.select(read_array
[, write_array
[, error_array
[, timeout]]]) -> array or nil
;T0[ I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@FI"Kernel;TcRDoc::NormalModule00 String-i.ri 0000644 00000001157 15237607406 0006612 0 ustar 00 U:RDoc::AnyMethod[iI"String:ETI"Kernel#String;TF:publico:RDoc::Markup::Document:@parts[
o:RDoc::Markup::Paragraph; [I"1Returns arg as a String.;To:RDoc::Markup::BlankLine o;
; [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::NormalModule00 block_given%3f-i.ri 0000644 00000001411 15237607406 0010115 0 ustar 00 U:RDoc::AnyMethod[iI"block_given?:ETI"Kernel#block_given?;TF:publico: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::BlankLine o: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::NormalModule00 binding-i.ri 0000644 00000001351 15237607406 0006752 0 ustar 00 U:RDoc::AnyMethod[iI"binding:ETI"Kernel#binding;TF:publico: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::BlankLine o:RDoc::Markup::Verbatim; [
I"def get_binding(param)
;TI" return 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::NormalModule00 frozen%3f-i.ri 0000644 00000000770 15237607406 0007145 0 ustar 00 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::BlankLine o: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::NormalModule00 Pathname-i.ri 0000644 00000001354 15237607406 0007100 0 ustar 00 U:RDoc::AnyMethod[iI"
Pathname:ETI"Kernel#Pathname;TF:publico: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::BlankLine o;
; [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::NormalModule00 printf-i.ri 0000644 00000001013 15237607406 0006635 0 ustar 00 U:RDoc::AnyMethod[iI"printf:ETI"Kernel#printf;TF:publico: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::NormalModule00 chomp-i.ri 0000644 00000000731 15237607406 0006447 0 ustar 00 U:RDoc::AnyMethod[iI"
chomp:ETI"Kernel#chomp;TF:publico: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::NormalModule00 autoload%3f-i.ri 0000644 00000001003 15237607406 0007440 0 ustar 00 U:RDoc::AnyMethod[iI"autoload?:ETI"Kernel#autoload?;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"@Returns _filename_ to be loaded if _name_ is registered as ;TI"+autoload+.;To:RDoc::Markup::BlankLine o: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"(autoload?(name) -> String or nil
;T0[ I" (p1);T@FI"Kernel;TcRDoc::NormalModule00 local_variables-i.ri 0000644 00000001026 15237607406 0010461 0 ustar 00 U:RDoc::AnyMethod[iI"local_variables:ETI"Kernel#local_variables;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"6Returns the names of the current local variables.;To:RDoc::Markup::BlankLine o: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::NormalModule00 abort-i.ri 0000644 00000000743 15237607406 0006453 0 ustar 00 U:RDoc::AnyMethod[iI"
abort:ETI"Kernel#abort;TF:publico: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"6abort
Kernel::abort([msg])
Process::abort([msg])
;T0[ I" (p1);T@FI"Kernel;TcRDoc::NormalModule00 y-i.ri 0000644 00000000514 15237607406 0005610 0 ustar 00 U:RDoc::AnyMethod[iI"y:EFI"
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::NormalModule00 Integer-i.ri 0000644 00000002521 15237607406 0006735 0 ustar 00 U:RDoc::AnyMethod[iI"Integer:ETI"Kernel#Integer;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JConverts arg to a Fixnum or Bignum. ;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"Minteger 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"BIn any case, strings should be strictly conformed to numeric ;TI"=representation. This behavior is different from that of ;TI"MString#to_i. Non string values will be converted by first ;TI"Rtrying to_int, then to_i. Passing nil ;TI"raises a TypeError.;To:RDoc::Markup::BlankLine 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(nil) #=> TypeError;T:@format0:
@fileI"
object.c;T:0@omit_headings_from_table_of_contents_below0I"(Integer(arg, base=0) -> integer
;T0[ I"(p1, p2 = v2);T@!FI"Kernel;TcRDoc::NormalModule00 spawn-i.ri 0000644 00000030626 15237607406 0006477 0 ustar 00 U:RDoc::AnyMethod[iI"
spawn:ETI"Kernel#spawn;TF:publico:RDoc::Markup::Document:@parts[\o:RDoc::Markup::Paragraph; [I"9spawn executes specified command and return its pid.;To:RDoc::Markup::BlankLine o: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"1use 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;; [:I"env: hash
;TI"2 name => val : set the environment variable
;TI"4 name => nil : unset the environment variable
;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"@ :pgroup => pgid : join to 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"0 :close_others => true : don't inherit
;TI" current directory:
;TI" :chdir => str
;TI"
;TI"F The 'cmdname, arg1, ...' form does not use the shell. However,
;TI"D on different OSes, different things are provided as built-in
;TI"C commands. An example of this is 'echo', which is a built-in
;TI"B on Windows, but is a normal program on Linux and Mac OS X.
;TI"E This means that `Process.spawn 'echo', '%Path%'` will display
;TI"E the contents of the `%Path%` environment variable on Windows,
;TI"G but `Process.spawn 'echo', '$PATH'` prints the literal '$PATH'.
;T;
0o;
; [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"GThe corresponding value should be true, zero or positive integer. ;TI"Itrue and zero means the process should be a process leader of a new ;TI"process group. ;TI":Other values specifies a process group to be belongs.;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"TThe :in, :out, :err, a fixnum, 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"/The hash keys specifies a file descriptor ;TI"9in the child process started by spawn. ;TI"E:err, 2 and STDERR specifies the standard error stream (stderr).;T@o;
; [I"1The hash values specifies a file descriptor ;TI"=in the parent process 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"6pid = spawn(command, 3=>"/dev/null") # read mode
;T;
0o;
; [I"For stdout and stderr, ;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 true 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"9See 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@@FI"Kernel;TcRDoc::NormalModule00 jj-i.ri 0000644 00000000576 15237607406 0005753 0 ustar 00 U:RDoc::AnyMethod[iI"jj:EFI"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::NormalModule00 trace_var-i.ri 0000644 00000002025 15237607406 0007305 0 ustar 00 U:RDoc::AnyMethod[iI"trace_var:ETI"Kernel#trace_var;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HControls tracing of assignments to global variables. The parameter ;FI"D+symbol_ identifies the variable (as either a string name or a ;FI";symbol identifier). _cmd_ (which may be a string or a ;FI"?+Proc+ object) or block is executed whenever the variable ;FI":is assigned. The block or +Proc+ object receives the ;FI"3variable's new value as a parameter. Also see ;FI"&Kernel::untrace_var.;Fo:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"8trace_var :$_, proc {|v| puts "$_ is now '#{v}'" }
;TI"$_ = "hello"
;TI"$_ = ' there'
;T:@format0o;
; [I"produces:;F@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
;F0[ I"(p1, p2 = v2);T@!FI"Kernel;TcRDoc::NormalModule00 pp-i.ri 0000644 00000000671 15237607406 0005763 0 ustar 00 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::BlankLine o;
; [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::NormalModule00 proc-i.ri 0000644 00000000512 15237607406 0006301 0 ustar 00 U:RDoc::AnyMethod[iI" proc:ETI"Kernel#proc;TF:publico: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::NormalModule00 class-i.ri 0000644 00000001067 15237607406 0006451 0 ustar 00 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::BlankLine o: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::NormalModule00 pp-c.ri 0000644 00000000672 15237607406 0005756 0 ustar 00 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::BlankLine o;
; [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::NormalModule00 gets-i.ri 0000644 00000003057 15237607406 0006307 0 ustar 00 U:RDoc::AnyMethod[iI" gets:ETI"Kernel#gets;TF:publico: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"Ifilenames are present in +ARGV+, +gets(nil)+ will read the contents ;TI"one file at a time.;To:RDoc::Markup::BlankLine o: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"hgets(sep=$/) -> string or nil
gets(limit) -> string or nil
gets(sep,limit) -> string or nil
;T0[ I"(*args);T@+FI"Kernel;TcRDoc::NormalModule00 then-i.ri 0000644 00000002116 15237607406 0006276 0 ustar 00 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::BlankLine o: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::NormalModule00 exec-i.ri 0000644 00000007052 15237607406 0006270 0 ustar 00 U:RDoc::AnyMethod[iI" exec:ETI"Kernel#exec;TF:publico: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::BlankLine o: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"+same as ENV["RUBYSHELL"] ;TI"H(or ENV["COMSPEC"] on Windows NT series), and similar.;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"3no shell reserved word and no 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"PIf 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::NormalModule00 JSON-i.ri 0000644 00000001213 15237607406 0006106 0 ustar 00 U:RDoc::AnyMethod[iI" JSON:EFI"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::BlankLine o;
; [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::NormalModule00 __method__-i.ri 0000644 00000000674 15237607406 0007423 0 ustar 00 U:RDoc::AnyMethod[iI"__method__:ETI"Kernel#__method__;TF:publico: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::NormalModule00 untrace_var-i.ri 0000644 00000001073 15237607406 0007652 0 ustar 00 U:RDoc::AnyMethod[iI"untrace_var:ETI"Kernel#untrace_var;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"CRemoves tracing for the specified command on the given global ;FI"=variable and returns +nil+. If no command is specified, ;FI"@removes all tracing for that variable and returns an array ;FI".containing the commands actually removed.;F:
@fileI"eval.c;T:0@omit_headings_from_table_of_contents_below0I"4untrace_var(symbol [, cmd] ) -> array or nil
;F0[ I"(p1, p2 = v2);T@FI"Kernel;TcRDoc::NormalModule00 j-i.ri 0000644 00000000555 15237607406 0005576 0 ustar 00 U:RDoc::AnyMethod[iI"j:EFI"
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::NormalModule00 sleep-i.ri 0000644 00000001617 15237607406 0006455 0 ustar 00 U:RDoc::AnyMethod[iI"
sleep:ETI"Kernel#sleep;TF:publico: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"Othread calls Thread#run. Called without an argument, sleep() ;TI"will sleep forever.;To:RDoc::Markup::BlankLine o: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]) -> fixnum
;T0[ I"(*args);T@FI"Kernel;TcRDoc::NormalModule00 readlines-i.ri 0000644 00000000747 15237607406 0007316 0 ustar 00 U:RDoc::AnyMethod[iI"readlines:ETI"Kernel#readlines;TF:publico: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"_readlines(sep=$/) -> array
readlines(limit) -> array
readlines(sep,limit) -> array
;T0[ I"(*args);T@FI"Kernel;TcRDoc::NormalModule00 gsub-i.ri 0000644 00000001002 15237607406 0006271 0 ustar 00 U:RDoc::AnyMethod[iI" gsub:ETI"Kernel#gsub;TF:publico: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::NormalModule00 clone-i.ri 0000644 00000002334 15237607406 0006442 0 ustar 00 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::BlankLine o: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::NormalModule00 sub-i.ri 0000644 00000001005 15237607406 0006125 0 ustar 00 U:RDoc::AnyMethod[iI"sub:ETI"Kernel#sub;TF:publico: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::NormalModule00 __callee__-i.ri 0000644 00000000652 15237607406 0007364 0 ustar 00 U:RDoc::AnyMethod[iI"__callee__:ETI"Kernel#__callee__;TF:publico: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::NormalModule00 gem-i.ri 0000644 00000003076 15237607406 0006116 0 ustar 00 U:RDoc::AnyMethod[iI"gem:EFI"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::BlankLine o;
; [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"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:RDoc::Markup::Verbatim; [I"