From a78d9cd85ad3ea62c2a07163b1ab8fdc54ee7026 Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 4 Dec 2008 08:55:02 +0000 Subject: merges r20472 from trunk into ruby_1_9_1. update rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index b4bd70fb01..eb954f22f3 100644 --- a/io.c +++ b/io.c @@ -1313,7 +1313,7 @@ rb_io_fileno(VALUE io) * ios.pid => fixnum * * Returns the process ID of a child process associated with - * ios. This will be set by IO::popen. + * ios. This will be set by IO.popen. * * pipe = IO.popen("-") * if pipe @@ -4692,15 +4692,25 @@ pop_last_hash(int *argc_p, VALUE *argv) * a hash at last for options similar to spawn. The default * mode for the new file object is ``r'', but mode may be set * to any of the modes listed in the description for class IO. + * The last argument opt qualifies mode. * - * Raises exceptions which IO::pipe and - * Kernel::system raise. + * # set IO encoding + * nkf_io = IO.popen("nkf -e filename", :external_encoding=>"EUC-JP") + * euc_jp_string = nkf_io.read + * + * # merge standard output and standard error using + * # spawn option. See the document of Kernel.spawn. + * ls_io = IO.popen(["ls", "/", STDERR=>[:child, STDOUT]]) + * ls_result_with_error = ls_io.read + * + * Raises exceptions which IO.pipe and + * Kernel.spawn raise. * * If a block is given, Ruby will run the command as a child connected * to Ruby with a pipe. Ruby's end of the pipe will be passed as a * parameter to the block. * At the end of block, Ruby close the pipe and sets $?. - * In this case IO::popen returns + * In this case IO.popen returns * the value of the block. * * If a block is given with a _cmd_ of ``-'', @@ -4836,10 +4846,10 @@ rb_open_file(int argc, VALUE *argv, VALUE io) * IO.open(fd, mode_string="r" [, opt] ) {|io| block } => obj * * With no associated block, open is a synonym for - * IO::new. If the optional code block is given, it will + * IO.new. If the optional code block is given, it will * be passed io as an argument, and the IO object will * automatically be closed when the block terminates. In this instance, - * IO::open returns the value of the block. + * IO.open returns the value of the block. * */ @@ -5730,7 +5740,7 @@ rb_io_stdio_file(rb_io_t *fptr) * Returns a new IO object (a stream) for the given * IO object or integer file descriptor and mode * string. See also IO#fileno and - * IO::for_fd. + * IO.for_fd. * * puts IO.new($stdout).fileno # => 1 * @@ -5825,7 +5835,7 @@ rb_file_initialize(int argc, VALUE *argv, VALUE io) * * Returns a new IO object (a stream) for the given * integer file descriptor and mode string. See also - * IO#fileno and IO::for_fd. + * IO#fileno and IO.for_fd. * * a = IO.new(2,"w") # '2' is standard error * $stderr.puts "Hello" @@ -5854,7 +5864,7 @@ rb_io_s_new(int argc, VALUE *argv, VALUE klass) * call-seq: * IO.for_fd(fd, mode [, opt]) => io * - * Synonym for IO::new. + * Synonym for IO.new. * */ -- cgit v1.2.3