summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ext/io/console/console.c26
-rw-r--r--io.c29
-rw-r--r--version.h2
4 files changed, 62 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 426a6540d5..3c713768c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Mar 6 12:29:34 2012 Eric Hodel <drbrain@segment7.net>
+
+ * 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
+
Tue Mar 6 11:42:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/syck/lib/syck/rubytypes.rb (Exception.yaml_new): fix bug
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 6fa0e906ac..cd5ffd94fb 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -247,6 +247,8 @@ ttymode(VALUE io, VALUE (*func)(VALUE), void (*setter)(conmode *))
* 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(VALUE io)
@@ -261,6 +263,8 @@ console_raw(VALUE io)
* 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(VALUE io)
@@ -288,6 +292,8 @@ getc_call(VALUE io)
* io.getch -> char
*
* Reads and returns a character in raw mode.
+ *
+ * You must require 'io/console' to use this method.
*/
static VALUE
console_getch(VALUE io)
@@ -304,6 +310,8 @@ console_getch(VALUE io)
* 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)
@@ -316,6 +324,8 @@ console_noecho(VALUE io)
* 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)
@@ -340,6 +350,8 @@ console_set_echo(VALUE io, VALUE f)
* 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)
@@ -379,6 +391,8 @@ typedef CONSOLE_SCREEN_BUFFER_INFO rb_console_size_t;
* io.winsize -> [rows, columns]
*
* Returns console size.
+ *
+ * You must require 'io/console' to use this method.
*/
static VALUE
console_winsize(VALUE io)
@@ -399,6 +413,8 @@ console_winsize(VALUE io)
*
* 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)
@@ -410,7 +426,9 @@ console_set_winsize(VALUE io, VALUE size)
int newrow, newcol;
#endif
VALUE row, col, xpixel, ypixel;
+#if defined TIOCSWINSZ
int fd;
+#endif
GetOpenFile(io, fptr);
size = rb_Array(size);
@@ -456,6 +474,8 @@ console_set_winsize(VALUE io, VALUE size)
* io.iflush
*
* Flushes input buffer in kernel.
+ *
+ * You must require 'io/console' to use this method.
*/
static VALUE
console_iflush(VALUE io)
@@ -476,6 +496,8 @@ console_iflush(VALUE io)
* io.oflush
*
* Flushes output buffer in kernel.
+ *
+ * You must require 'io/console' to use this method.
*/
static VALUE
console_oflush(VALUE io)
@@ -496,6 +518,8 @@ console_oflush(VALUE io)
* io.ioflush
*
* Flushes input and output buffers in kernel.
+ *
+ * You must require 'io/console' to use this method.
*/
static VALUE
console_ioflush(VALUE io)
@@ -525,6 +549,8 @@ console_ioflush(VALUE io)
* 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)
diff --git a/io.c b/io.c
index 2945764d64..0e17d44ba6 100644
--- a/io.c
+++ b/io.c
@@ -10699,6 +10699,35 @@ argf_write(VALUE argf, VALUE str)
* 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
diff --git a/version.h b/version.h
index 060850174c..66016c7e2b 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 157
+#define RUBY_PATCHLEVEL 158
#define RUBY_RELEASE_DATE "2012-03-06"
#define RUBY_RELEASE_YEAR 2012