summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/array.c b/array.c
index c0f6dd8cb6..76a3a6279d 100644
--- a/array.c
+++ b/array.c
@@ -1839,13 +1839,12 @@ ary_join_1(VALUE obj, VALUE ary, VALUE sep, long i, VALUE result, int *first)
rb_str_buf_append(result, sep);
val = RARRAY_PTR(ary)[i];
- switch (TYPE(val)) {
- case T_STRING:
+ if (RB_TYPE_P(val, T_STRING)) {
str_join:
rb_str_buf_append(result, val);
*first = FALSE;
- break;
- case T_ARRAY:
+ }
+ else if (RB_TYPE_P(val, T_ARRAY)) {
obj = val;
ary_join:
if (val == ary) {
@@ -1860,8 +1859,8 @@ ary_join_1(VALUE obj, VALUE ary, VALUE sep, long i, VALUE result, int *first)
args[3] = (VALUE)first;
rb_exec_recursive(recursive_join, obj, (VALUE)args);
}
- break;
- default:
+ }
+ else {
tmp = rb_check_string_type(val);
if (!NIL_P(tmp)) {
val = tmp;