summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/array.c b/array.c
index c1ad9981c1..28ea06fb3e 100644
--- a/array.c
+++ b/array.c
@@ -589,10 +589,17 @@ ary_join(ary, sep)
VALUE result, tmp;
if (ary->len == 0) return str_new(0, 0);
- if (TYPE(ary->ptr[0]) == T_STRING)
+ switch (TYPE(ary->ptr[0])) {
+ case T_STRING:
result = str_dup(ary->ptr[0]);
- else
+ break;
+ case T_ARRAY:
+ result = ary_join(ary->ptr[0], sep);
+ break;
+ default:
result = obj_as_string(ary->ptr[0]);
+ break;
+ }
for (i=1; i<ary->len; i++) {
tmp = ary->ptr[i];