diff options
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1778,7 +1778,8 @@ rb_ary_empty_p(VALUE ary) VALUE rb_ary_dup(VALUE ary) { - VALUE dup = rb_ary_new2(RARRAY_LEN(ary)); + VALUE ary_class = rb_obj_class(ary); + VALUE dup = ary_new(ary_class ? ary_class : rb_cArray, RARRAY_LEN(ary)); MEMCPY(RARRAY_PTR(dup), RARRAY_PTR(ary), VALUE, RARRAY_LEN(ary)); ARY_SET_LEN(dup, RARRAY_LEN(ary)); return dup; |