ext/io/console/console.c in io-console-0.5.5 vs ext/io/console/console.c in io-console-0.5.6

- old
+ new

@@ -109,19 +109,23 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t *opts) { int argc = *argcp; rawmode_arg_t *optp = NULL; VALUE vopts = Qnil; +#ifdef RB_SCAN_ARGS_PASS_CALLED_KEYWORDS + argc = rb_scan_args(argc, argv, "*:", NULL, &vopts); +#else if (argc > min_argc) { vopts = rb_check_hash_type(argv[argc-1]); if (!NIL_P(vopts)) { argv[argc-1] = vopts; vopts = rb_extract_keywords(&argv[argc-1]); if (!argv[argc-1]) *argcp = --argc; if (!vopts) vopts = Qnil; } } +#endif rb_check_arity(argc, min_argc, max_argc); if (!NIL_P(vopts)) { VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min)); VALUE vtime = rb_hash_aref(vopts, ID2SYM(id_time)); VALUE intr = rb_hash_aref(vopts, ID2SYM(id_intr)); @@ -354,13 +358,13 @@ } #endif /* * call-seq: - * io.raw(min: nil, time: nil) {|io| } + * io.raw(min: nil, time: nil, intr: nil) {|io| } * - * Yields +self+ within raw mode. + * Yields +self+ within raw mode, and returns the result of the block. * * STDIN.raw(&:gets) * * will read and return a line without echo back and line editing. * @@ -368,10 +372,13 @@ * should be received when a read operation is performed. (default: 1) * * The parameter +time+ specifies the timeout in _seconds_ with a * precision of 1/10 of a second. (default: 0) * + * If the parameter +intr+ is +true+, enables break, interrupt, quit, + * and suspend special characters. + * * Refer to the manual page of termios for further details. * * You must require 'io/console' to use this method. */ static VALUE @@ -381,15 +388,15 @@ return ttymode(io, rb_yield, io, set_rawmode, optp); } /* * call-seq: - * io.raw!(min: nil, time: nil) + * io.raw!(min: nil, time: nil, intr: nil) -> io * - * Enables raw mode. + * Enables raw mode, and returns +io+. * - * If the terminal mode needs to be back, use io.raw { ... }. + * If the terminal mode needs to be back, use <code>io.raw { ... }</code>. * * See IO#raw for details on the parameters. * * You must require 'io/console' to use this method. */ @@ -481,11 +488,11 @@ } #endif /* * call-seq: - * io.getch(min: nil, time: nil) -> char + * io.getch(min: nil, time: nil, intr: nil) -> char * * Reads and returns a character in raw mode. * * See IO#raw for details on the parameters. * @@ -1488,10 +1495,10 @@ return con; } /* * call-seq: - * io.getch(min: nil, time: nil) -> char + * io.getch(min: nil, time: nil, intr: nil) -> char * * See IO#getch. */ static VALUE io_getch(int argc, VALUE *argv, VALUE io)