diff options
Diffstat (limited to 'ext/io/console/console.c')
-rw-r--r-- | ext/io/console/console.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 5b6705d45b..228ac80fef 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -718,6 +718,12 @@ console_dev(VALUE klass) return con; } +static VALUE +io_getch(int argc, VALUE *argv, VALUE io) +{ + return rb_funcall2(io, rb_intern("getc"), argc, argv); +} + /* * IO console methods */ @@ -746,4 +752,8 @@ InitVM_console(void) rb_define_method(rb_cIO, "oflush", console_oflush, 0); rb_define_method(rb_cIO, "ioflush", console_ioflush, 0); rb_define_singleton_method(rb_cIO, "console", console_dev, 0); + { + VALUE mReadable = rb_define_module_under(rb_cIO, "readable"); + rb_define_method(mReadable, "getch", io_getch, -1); + } } |