ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- pretty_inspect-i.ri000064400000001040152376074050010406 0ustar00U: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::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::NormalModule00fork-i.ri000064400000002650152376074050006303 0ustar00U: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::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"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::NormalModule00raise-i.ri000064400000002156152376074050006446 0ustar00U: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::BlankLineo: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::NormalModule00Rational-i.ri000064400000002262152376074050007112 0ustar00U:RDoc::AnyMethod[iI" Rational:ETI"Kernel#Rational;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Returns x/y;;To:RDoc::Markup::BlankLineo: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::NormalModule00Hash-i.ri000064400000001253152376074050006223 0ustar00U: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::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::NormalModule00format-i.ri000064400000031515152376074050006634 0ustar00U: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::BlankLineo; ; [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::NormalModule00eval-i.ri000064400000001671152376074050006273 0ustar00U: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::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::NormalModule00readline-i.ri000064400000000717152376074050007127 0ustar00U: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::NormalModule00system-i.ri000064400000002652152376074050006670 0ustar00U: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::BlankLineo: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::NormalModule00warn-i.ri000064400000001207152376074050006306 0ustar00U: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::BlankLineo: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::NormalModule00print-i.ri000064400000001732152376074050006476 0ustar00U: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::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::NormalModule00caller-i.ri000064400000003010152376074050006573 0ustar00U: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::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::NormalModule00throw-i.ri000064400000001166152376074050006506 0ustar00U: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::NormalModule00fail-i.ri000064400000002151152376074050006251 0ustar00U: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::BlankLineo: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::NormalModule00loop-i.ri000064400000001242152376074050006307 0ustar00U: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::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"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::NormalModule00Float-i.ri000064400000001165152376074050006407 0ustar00U: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::BlankLineo: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::NormalModule00chop-i.ri000064400000000714152376074050006272 0ustar00U: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::NormalModule00URI-c.ri000064400000000465152376074050005775 0ustar00U: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::NormalModule00URI-i.ri000064400000000464152376074050006002 0ustar00U: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::NormalModule00puts-i.ri000064400000000615152376074050006334 0ustar00U:RDoc::AnyMethod[iI" puts:ETI"Kernel#puts;TF: publico: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::NormalModule00gem_original_require-i.ri000064400000000610152376074050011524 0ustar00U: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;Fyield_self-i.ri000064400000001414152376074050007456 0ustar00U: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::NormalModule00callcc-i.ri000064400000001546152376074050006566 0ustar00U: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::NormalModule00caller_locations-i.ri000064400000002110152376074050010646 0ustar00U: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::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::NormalModule00at_exit-i.ri000064400000001501152376074050006771 0ustar00U: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::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::NormalModule00global_variables-i.ri000064400000000764152376074050010636 0ustar00U: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::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 ;F0[I"();T@FI" Kernel;TcRDoc::NormalModule00Array-i.ri000064400000001000152376074050006404 0ustar00U: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::BlankLineo; ; [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.ri000064400000001030152376074050006512 0ustar00U: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::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"(p1 = v1);T@FI" Kernel;TcRDoc::NormalModule00%60-i.ri000064400000001312152376074050005626 0ustar00U: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::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::NormalModule00set_trace_func-i.ri000064400000004634152376074050010332 0ustar00U: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::BlankLineo; ; [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::NormalModule00Complex-i.ri000064400000002743152376074050006754 0ustar00U: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::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 ;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::NormalModule00iterator%3f-i.ri000064400000001403152376074050007464 0ustar00U: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::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"$iterator? -> true or false;T0[I"();T@FI" Kernel;TcRDoc::NormalModule00putc-i.ri000064400000000740152376074050006313 0ustar00U: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::NormalModule00BigDecimal-i.ri000064400000000527152376074050007323 0ustar00U: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::NormalModule00srand-i.ri000064400000002527152376074050006454 0ustar00U: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::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"(p1 = v1);T@"FI" Kernel;TcRDoc::NormalModule00p-i.ri000064400000001247152376074050005602 0ustar00U: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::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::NormalModule00lambda-i.ri000064400000000652152376074050006562 0ustar00U: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::NormalModule00select-i.ri000064400000014760152376074050006626 0ustar00U: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::BlankLineo; ; [ 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::NormalModule00String-i.ri000064400000001157152376074060006612 0ustar00U: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::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::NormalModule00block_given%3f-i.ri000064400000001411152376074060010115 0ustar00U: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::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::NormalModule00binding-i.ri000064400000001351152376074060006752 0ustar00U: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::BlankLineo: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::NormalModule00frozen%3f-i.ri000064400000000770152376074060007145 0ustar00U: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::NormalModule00Pathname-i.ri000064400000001354152376074060007100 0ustar00U: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::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::NormalModule00printf-i.ri000064400000001013152376074060006635 0ustar00U: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::NormalModule00chomp-i.ri000064400000000731152376074060006447 0ustar00U: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::NormalModule00autoload%3f-i.ri000064400000001003152376074060007440 0ustar00U: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::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"(autoload?(name) -> String or nil ;T0[I" (p1);T@FI" Kernel;TcRDoc::NormalModule00local_variables-i.ri000064400000001026152376074060010461 0ustar00U: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::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::NormalModule00abort-i.ri000064400000000743152376074060006453 0ustar00U: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::NormalModule00y-i.ri000064400000000514152376074060005610 0ustar00U: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::NormalModule00Integer-i.ri000064400000002521152376074060006735 0ustar00U: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::BlankLineo: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::NormalModule00spawn-i.ri000064400000030626152376074060006477 0ustar00U: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::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"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::NormalModule00jj-i.ri000064400000000576152376074060005753 0ustar00U: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::NormalModule00trace_var-i.ri000064400000002025152376074060007305 0ustar00U: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::BlankLineo: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::NormalModule00pp-i.ri000064400000000671152376074060005763 0ustar00U: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::NormalModule00proc-i.ri000064400000000512152376074060006301 0ustar00U: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::NormalModule00class-i.ri000064400000001067152376074060006451 0ustar00U: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::NormalModule00pp-c.ri000064400000000672152376074060005756 0ustar00U: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::NormalModule00gets-i.ri000064400000003057152376074060006307 0ustar00U: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::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"hgets(sep=$/) -> string or nil gets(limit) -> string or nil gets(sep,limit) -> string or nil ;T0[I" (*args);T@+FI" Kernel;TcRDoc::NormalModule00then-i.ri000064400000002116152376074060006276 0ustar00U: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::NormalModule00exec-i.ri000064400000007052152376074060006270 0ustar00U: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::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"+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::NormalModule00JSON-i.ri000064400000001213152376074060006106 0ustar00U: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::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::NormalModule00__method__-i.ri000064400000000674152376074060007423 0ustar00U: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::NormalModule00untrace_var-i.ri000064400000001073152376074060007652 0ustar00U: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::NormalModule00j-i.ri000064400000000555152376074060005576 0ustar00U: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::NormalModule00sleep-i.ri000064400000001617152376074060006455 0ustar00U: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::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]) -> fixnum ;T0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00readlines-i.ri000064400000000747152376074060007316 0ustar00U: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::NormalModule00gsub-i.ri000064400000001002152376074060006271 0ustar00U: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::NormalModule00clone-i.ri000064400000002334152376074060006442 0ustar00U: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::NormalModule00sub-i.ri000064400000001005152376074060006125 0ustar00U: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.ri000064400000000652152376074060007364 0ustar00U: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::NormalModule00gem-i.ri000064400000003076152376074060006116 0ustar00U: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::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"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"Kernel::require) ;TI"Ithe first time that _module_ (which may be a String or ;TI"a symbol) is accessed.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"?autoload(:MyModule, "/usr/local/lib/modules/my_module.rb");T: @format0: @fileI" load.c;T:0@omit_headings_from_table_of_contents_below0I")autoload(module, filename) -> nil ;T0[I" (p1, p2);T@FI" Kernel;TcRDoc::NormalModule00test-i.ri000064400000006000152376074060006313 0ustar00U:RDoc::AnyMethod[iI" test:ETI"Kernel#test;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"GUses the integer +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::NormalModule00catch-i.ri000064400000002506152376074060006425 0ustar00U:RDoc::AnyMethod[iI" catch:ETI"Kernel#catch;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"1+catch+ executes its block. If a +throw+ is ;TI">executed, Ruby searches up its stack for a +catch+ block ;TI"/with a tag corresponding to the +throw+'s ;TI"4_tag_. If found, that block is terminated, and ;TI"4+catch+ returns the value given to +throw+. If ;TI"?+throw+ is not called, the block terminates normally, and ;TI">the value of +catch+ is the value of the last expression ;TI";evaluated. +catch+ expressions may be nested, and the ;TI"/+throw+ call need not be in lexical scope.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"def routine(n) ;TI" puts n ;TI" throw :done if n <= 0 ;TI" routine(n-1) ;TI" end ;TI" ;TI"!catch(:done) { routine(3) } ;T: @format0o; ; [I"produces:;T@o; ; [ I"3 ;TI"2 ;TI"1 ;TI"0 ;T; 0o; ; [ I">when _arg_ is given, +catch+ yields it as is, or when no ;TI"<_arg_ is given, +catch+ assigns a new unique object to ;TI"=+throw+. this is useful for nested +catch+. _arg_ can ;TI"-be an arbitrary object, not only Symbol.;T: @fileI"vm_eval.c;T:0@omit_headings_from_table_of_contents_below0I")catch([arg]) {|tag| block } -> obj ;T0[I"(p1 = v1);T@/FI" Kernel;TcRDoc::NormalModule00exit-i.ri000064400000002741152376074060006315 0ustar00U:RDoc::AnyMethod[iI" exit:ETI"Kernel#exit;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"AInitiates the termination of the Ruby script by raising the ;TI"JSystemExit 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"QJust prior to termination, Ruby executes any at_exit functions ;TI"?(see Kernel::at_exit) and runs any object finalizers (see ;TI"$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"(p1 = v1);T@6FI" Kernel;TcRDoc::NormalModule00require-i.ri000064400000002124152376074060007013 0ustar00U:RDoc::AnyMethod[iI" require:EFI"Kernel#require;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NWhen RubyGems is required, Kernel#require is replaced with our own which ;TI"*is capable of loading gems on demand.;To:RDoc::Markup::BlankLineo; ; [I">When you call require 'x', this is what happens:;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"CIf the file can be loaded from the existing Ruby loadpath, it ;TI"is.;To;;0; [o; ; [I"EOtherwise, installed gems are searched for a file that matches. ;TI"CIf it's found in gem 'y', that gem is activated (added to the ;TI"loadpath).;T@o; ; [I"EThe normal require functionality of returning false if ;TI"4that file has already been loaded is preserved.;T: @fileI",lib/rubygems/core_ext/kernel_require.rb;T:0@omit_headings_from_table_of_contents_below000[[I"gem_original_require;Fo;; [o; ; [I"8The Kernel#require from before RubyGems was loaded.;T;@&;0I" (path);T@&FI" Kernel;TcRDoc::NormalModule00require_relative-i.ri000064400000001046152376074060010710 0ustar00U:RDoc::AnyMethod[iI"require_relative:ETI"Kernel#require_relative;TF: publico: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::NormalModule00cdesc-Kernel.ri000064400000007152152376074060007416 0ustar00U: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/psych/lib/psych/y.rb;T; 0o;;[; I"lib/open-uri.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/scanf.rb;T; 0o;;[ o; ;[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@+o:RDoc::Markup::Verbatim;[I"$sprintf "%.1f", 1.234 #=> "1.2";T: @format0; I" object.c;T; 0; 0; 0[[[[[I" class;T[[: public[[I" open;TI"lib/open-uri.rb;T[:protected[[: private[[I"open_uri_original_open;F@@[I" instance;T[[;[I[I" Array;TI" object.c;T[I"BigDecimal;TI" ext/bigdecimal/bigdecimal.c;T[I" Complex;TI"complex.c;T[I" Float;T@N[I" Hash;T@N[I" Integer;T@N[I" Pathname;TI"ext/pathname/pathname.c;T[I" Rational;TI"rational.c;T[I" String;T@N[I"__callee__;TI" eval.c;T[I" __dir__;T@e[I"__method__;T@e[I"`;TI" io.c;T[I" abort;TI"process.c;T[I" at_exit;TI"eval_jump.c;T[I" autoload;TI" load.c;T[I"autoload?;T@u[I" binding;TI" proc.c;T[I"block_given?;TI"vm_eval.c;T[I" callcc;TI" cont.c;T[I" caller;TI"vm_backtrace.c;T[I"caller_locations;T@~[I" catch;T@}[I" chomp;TI" ruby.c;T[I" chop;T@[I" eval;T@}[I" exec;T@o[I" exit;T@o[I" exit!;T@o[I" fail;T@e[I" fork;T@o[I" format;T@N[I"gem_original_require;FI",lib/rubygems/core_ext/kernel_require.rb;T[I" gets;T@l[I"global_variables;T@e[I" gsub;T@[I"iterator?;T@}[I" lambda;T@z[I" load;T@u[I"local_variables;T@}[I" loop;T@}[I"p;T@l[I"pretty_inspect;FI"lib/pp.rb;T[I" print;T@l[I" printf;T@l[I" proc;T@z[I" putc;T@l[I" puts;T@l[I" raise;T@e[I" rand;TI" random.c;T[I" readline;T@l[I"readlines;T@l[I"require_relative;T@u[I" select;T@l[I"set_trace_func;TI"vm_trace.c;T[I" sleep;T@o[I" spawn;T@o[I" sprintf;T@N[I" srand;T@[I"sub;T@[I" syscall;T@l[I" system;T@o[I" test;TI" file.c;T[I" throw;T@}[I"trace_var;T@e[I" trap;TI" signal.c;T[I"untrace_var;T@e[I" warn;TI" error.c;T[;[[;[[I" JSON;FI" ext/json/lib/json/common.rb;T[I"gem;FI"(lib/rubygems/core_ext/kernel_gem.rb;T[I"j;F@[I"jj;F@[@?@l[I"open_uri_original_open;F@@[I" require;F@[I" scanf;FI"lib/scanf.rb;T[I"y;FI"ext/psych/lib/psych/y.rb;T[[U:RDoc::Context::Section[i0o;;[; 0; 0[#I"complex.c;TI" cont.c;TI" error.c;TI" eval.c;TI"eval_jump.c;TI" ext/bigdecimal/bigdecimal.c;T@ I"ext/pathname/pathname.c;T@I" file.c;TI" io.c;TI"lib/minitest/spec.rb;T@@@@!@$I"lib/uri/common.rb;TI"lib/weakref.rb;TI" load.c;T@4I" proc.c;TI"process.c;TI" random.c;TI"rational.c;TI" ruby.c;TI" signal.c;TI"vm_backtrace.c;TI"vm_eval.c;TI"vm_trace.c;T@cRDoc::TopLevelload-i.ri000064400000001453152376074060006262 0ustar00U:RDoc::AnyMethod[iI" load:ETI"Kernel#load;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"!Loads and executes the Ruby ;TI">program in the file _filename_. If the filename does not ;TI"Jresolve to an absolute path, the file is searched for in the library ;TI"Cdirectories listed in $:. If the optional _wrap_ ;TI"=parameter is +true+, the loaded script will be executed ;TI"Hunder an anonymous module, protecting the calling program's global ;TI"Jnamespace. In no circumstance will any local variables in the loaded ;TI"3file be 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::NormalModule00trap-i.ri000064400000003067152376074060006314 0ustar00U:RDoc::AnyMethod[iI" trap:ETI"Kernel#trap;TF: publico: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::NormalModule00tap-i.ri000064400000001504152376074060006124 0ustar00U: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::NormalModule00__dir__-i.ri000064400000001144152376074060006712 0ustar00U:RDoc::AnyMethod[iI" __dir__:ETI"Kernel#__dir__;TF: publico: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::NormalModule00rand-i.ri000064400000002470152376074060006267 0ustar00U:RDoc::AnyMethod[iI" rand:ETI"Kernel#rand;TF: publico: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"(p1 = v1);T@/FI" Kernel;TcRDoc::NormalModule00syscall-i.ri000064400000003054152376074060007014 0ustar00U:RDoc::AnyMethod[iI" syscall:ETI"Kernel#syscall;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Verbatim; [I"ACalls the operating system function identified by _num_ and ;TI"Ereturns the result of the function or raises SystemCallError if ;TI"it failed. ;TI" ;TI"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"8as an integer whose bit size is same as a pointer. ;TI"?Up to nine parameters may be passed (14 on the Atari-ST). ;TI" ;TI"0The function identified by _num_ is system ;TI"Idependent. On some Unix systems, the numbers may be obtained from a ;TI"0header file called syscall.h. ;TI" ;TI"B syscall 4, 1, "hello\n", 6 # '4' is write(2) on our box ;TI" ;TI"produces: ;TI" ;TI" hello ;TI" ;TI"DCalling +syscall+ on a platform which does not have any way to ;TI"Gan arbitrary system function just fails with NotImplementedError. ;T: @format0o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" Note;T; [o:RDoc::Markup::Paragraph; [I"S+syscall+ is essentially unsafe and unportable. Feel free to shoot your foot. ;TI"TDL (Fiddle) library is preferred for safer and a bit more portable programming.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"+syscall(num [, args...]) -> integer ;T0[I" (*args);T@-FI" Kernel;TcRDoc::NormalModule00open-i.ri000064400000007145152376074060006310 0ustar00U: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" command.;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"open_uri_original_open;Fo;; [;I"lib/open-uri.rb;T;0[I"open_uri_original_open;Fo;; [;@;0I" (*args);T@}FI" Kernel;TcRDoc::NormalModule00sprintf-i.ri000064400000031517152376074060007034 0ustar00U:RDoc::AnyMethod[iI" sprintf:ETI"Kernel#sprintf;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::BlankLineo; ; [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"8sprintf(format_string [, arguments...] ) -> string;F0[I" (*args);T@FI" Kernel;TcRDoc::NormalModule00open_uri_original_open-c.ri000064400000000433152404453760012057 0ustar00U:RDoc::AnyMethod[iI"open_uri_original_open:EFI"#Kernel::open_uri_original_open;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/open-uri.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@ FI" Kernel;TcRDoc::NormalModule0[@TI" open;Topen_uri_original_open-i.ri000064400000000432152404453760012064 0ustar00U:RDoc::AnyMethod[iI"open_uri_original_open:EFI""Kernel#open_uri_original_open;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"lib/open-uri.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@ FI" Kernel;TcRDoc::NormalModule0[@FI" open;Topen-c.ri000064400000007145152404453760006302 0ustar00U:RDoc::AnyMethod[iI" open:ETI"Kernel::open;TT: publico: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" command.;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"open_uri_original_open;Fo;; [;I"lib/open-uri.rb;T;0[I"open_uri_original_open;Fo;; [;@;0I" (*args);T@FI" Kernel;TcRDoc::NormalModule00scanf-i.ri000064400000000765152404453760006442 0ustar00U:RDoc::AnyMethod[iI" scanf:EFI"Kernel#scanf;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"GScans STDIN for data matching +format+. See IO#scanf for details.;To:RDoc::Markup::BlankLineo; ; [I"7See Scanf for details on creating a format string.;T@o; ; [I":You will need to require 'scanf' to use Kernel#scanf.;T: @fileI"lib/scanf.rb;T:0@omit_headings_from_table_of_contents_below000[I"(format, &b);T@FI" Kernel;TcRDoc::NormalModule00