summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--class.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/class.c b/class.c
index 66495eb676..ce5547d617 100644
--- a/class.c
+++ b/class.c
@@ -1857,8 +1857,14 @@ NORETURN(static void keyword_error(const char *error, VALUE keys));
static void
keyword_error(const char *error, VALUE keys)
{
- const char *msg = RARRAY_LEN(keys) == 1 ? "" : "s";
- keys = rb_ary_join(keys, rb_usascii_str_new2(", "));
+ const char *msg = "";
+ if (RARRAY_LEN(keys) == 1) {
+ keys = RARRAY_AREF(keys, 0);
+ }
+ else {
+ keys = rb_ary_join(keys, rb_usascii_str_new2(", "));
+ msg = "s";
+ }
rb_raise(rb_eArgError, "%s keyword%s: %"PRIsVALUE, error, msg, keys);
}