ruby-changes:21919
From: drbrain <ko1@a...>
Date: Wed, 7 Dec 2011 10:49:53 +0900 (JST)
Subject: [ruby-changes:21919] drbrain:r33968 (trunk): * io.c (Init_IO): Mention io/console methods. [Ruby 1.9 - Bug #5602]
drbrain 2011-12-07 10:49:40 +0900 (Wed, 07 Dec 2011) New Revision: 33968 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33968 Log: * io.c (Init_IO): Mention io/console methods. [Ruby 1.9 - Bug #5602] * ext/io/console/console.c: Mention that io/console must be required similar to lib/time.rb Modified files: trunk/ChangeLog trunk/ext/io/console/console.c trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33967) +++ ChangeLog (revision 33968) @@ -1,3 +1,9 @@ +Wed Dec 7 09:48:00 2011 Eric Hodel <drbrain@s...> + + * io.c (Init_IO): Mention io/console methods. [Ruby 1.9 - Bug #5602] + * ext/io/console/console.c: Mention that io/console must be required + similar to lib/time.rb + Wed Dec 7 08:04:31 2011 Aaron Patterson <aaron@t...> * ext/psych/lib/psych.rb (module Psych): parse and load methods take Index: io.c =================================================================== --- io.c (revision 33967) +++ io.c (revision 33968) @@ -11097,6 +11097,35 @@ * command line (or STDIN if no files are mentioned). ARGF provides * the methods <code>#path</code> and <code>#filename</code> to access * the name of the file currently being read. + * + * == io/console + * + * The io/console extension provides methods for interacting with the + * console. The console can be accessed from <code>IO.console</code> or + * the standard input/output/error IO objects. + * + * Requiring io/console adds the following methods: + * + * * IO::console + * * IO#raw + * * IO#raw! + * * IO#cooked + * * IO#cooked! + * * IO#getch + * * IO#echo= + * * IO#echo? + * * IO#noecho + * * IO#winsize + * * IO#winsize= + * * IO#iflush + * * IO#ioflush + * * IO#oflush + * + * Example: + * + * require 'io/console' + * rows, columns = $stdin.winsize + * puts "You screen is #{columns} wide and #{rows} tall" */ void Index: ext/io/console/console.c =================================================================== --- ext/io/console/console.c (revision 33967) +++ ext/io/console/console.c (revision 33968) @@ -296,6 +296,8 @@ * STDIN.raw(&:gets) * * will read and return a line with echo back and line editing. + * + * You must require 'io/console' to use this method. */ static VALUE console_raw(int argc, VALUE *argv, VALUE io) @@ -311,6 +313,8 @@ * Enables raw mode. * * If the terminal mode needs to be back, use io.raw { ... }. + * + * You must require 'io/console' to use this method. */ static VALUE console_set_raw(int argc, VALUE *argv, VALUE io) @@ -337,6 +341,8 @@ * STDIN.cooked(&:gets) * * will read and return a line with echo back and line editing. + * + * You must require 'io/console' to use this method. */ static VALUE console_cooked(VALUE io) @@ -351,6 +357,8 @@ * Enables cooked mode. * * If the terminal mode needs to be back, use io.cooked { ... }. + * + * You must require 'io/console' to use this method. */ static VALUE console_set_cooked(VALUE io) @@ -378,6 +386,8 @@ * io.getch(min: nil, time: nil) -> char * * Reads and returns a character in raw mode. + * + * You must require 'io/console' to use this method. */ static VALUE console_getch(int argc, VALUE *argv, VALUE io) @@ -395,6 +405,8 @@ * STDIN.noecho(&:gets) * * will read and return a line without echo back. + * + * You must require 'io/console' to use this method. */ static VALUE console_noecho(VALUE io) @@ -407,6 +419,8 @@ * io.echo = flag * * Enables/disables echo back. + * + * You must require 'io/console' to use this method. */ static VALUE console_set_echo(VALUE io, VALUE f) @@ -431,6 +445,8 @@ * io.echo? -> true or false * * Returns +true+ if echo back is enabled. + * + * You must require 'io/console' to use this method. */ static VALUE console_echo_p(VALUE io) @@ -470,6 +486,8 @@ * io.winsize -> [rows, columns] * * Returns console size. + * + * You must require 'io/console' to use this method. */ static VALUE console_winsize(VALUE io) @@ -490,6 +508,8 @@ * * Tries to set console size. The effect depends on the platform and * the running environment. + * + * You must require 'io/console' to use this method. */ static VALUE console_set_winsize(VALUE io, VALUE size) @@ -549,6 +569,8 @@ * io.iflush * * Flushes input buffer in kernel. + * + * You must require 'io/console' to use this method. */ static VALUE console_iflush(VALUE io) @@ -569,6 +591,8 @@ * io.oflush * * Flushes output buffer in kernel. + * + * You must require 'io/console' to use this method. */ static VALUE console_oflush(VALUE io) @@ -589,6 +613,8 @@ * io.ioflush * * Flushes input and output buffers in kernel. + * + * You must require 'io/console' to use this method. */ static VALUE console_ioflush(VALUE io) @@ -618,6 +644,8 @@ * IO.console -> #<File:/dev/tty> * * Returns an File instance opened console. + * + * You must require 'io/console' to use this method. */ static VALUE console_dev(VALUE klass) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/