1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/io-console] Prefer keyword arguments

https://github.com/ruby/io-console/commit/5facbfc4c8
This commit is contained in:
Nobuyoshi Nakada 2020-02-14 15:59:36 +09:00
parent 1df2c8cefb
commit 78282d4655
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -111,6 +111,9 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t *
int argc = *argcp; int argc = *argcp;
rawmode_arg_t *optp = NULL; rawmode_arg_t *optp = NULL;
VALUE vopts = Qnil; VALUE vopts = Qnil;
#ifdef RB_SCAN_ARGS_PASS_CALLED_KEYWORDS
argc = rb_scan_args(argc, argv, "*:", NULL, &vopts);
#else
if (argc > min_argc) { if (argc > min_argc) {
vopts = rb_check_hash_type(argv[argc-1]); vopts = rb_check_hash_type(argv[argc-1]);
if (!NIL_P(vopts)) { if (!NIL_P(vopts)) {
@ -120,6 +123,7 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t *
if (!vopts) vopts = Qnil; if (!vopts) vopts = Qnil;
} }
} }
#endif
rb_check_arity(argc, min_argc, max_argc); rb_check_arity(argc, min_argc, max_argc);
if (!NIL_P(vopts)) { if (!NIL_P(vopts)) {
VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min)); VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min));