diff options
Diffstat (limited to 'ext/io/console')
-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 cd5ffd94fb..8a5c814dda 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -623,6 +623,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 */ @@ -649,4 +655,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); + } } |