summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'class.c')
-rw-r--r--class.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/class.c b/class.c
index ce5547d617..5a4bf05e3b 100644
--- a/class.c
+++ b/class.c
@@ -1912,8 +1912,13 @@ int
rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values)
{
int i = 0, j;
+ int rest = 0;
VALUE missing = Qnil;
+ if (optional < 0) {
+ rest = 1;
+ optional = -1-optional;
+ }
if (values) {
for (j = 0; j < required + optional; j++) {
values[j] = Qundef;
@@ -1945,6 +1950,8 @@ rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, V
j++;
}
}
+ }
+ if (!rest && keyword_hash) {
if (RHASH_SIZE(keyword_hash) > (unsigned int)j) {
unknown_keyword_error(keyword_hash, table, required+optional);
}