diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-09-12 05:37:38 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-09-12 05:37:38 +0000 |
| commit | a058870812c058c0c125fd1bf3edcab5a6656659 (patch) | |
| tree | 68bde87194755712893e5efa4d7f9d2f5312df10 /object.c | |
| parent | 837ac1a8368ba3eb7411b2a5b3a38bc7506be127 (diff) | |
| download | ruby-a058870812c058c0c125fd1bf3edcab5a6656659.tar.gz ruby-a058870812c058c0c125fd1bf3edcab5a6656659.tar.xz ruby-a058870812c058c0c125fd1bf3edcab5a6656659.zip | |
matz: 1.6.0 final (hopufully)
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
| -rw-r--r-- | object.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -990,8 +990,16 @@ VALUE rb_Array(val) VALUE val; { + ID to_ary; + if (TYPE(val) == T_ARRAY) return val; - val = rb_funcall(val, rb_intern("to_a"), 0); + to_ary = rb_intern("to_ary"); + if (rb_respond_to(val, to_ary)) { + val = rb_funcall(val, to_ary, 0); + } + else { + val = rb_funcall(val, rb_intern("to_a"), 0); + } if (TYPE(val) != T_ARRAY) { rb_raise(rb_eTypeError, "`to_a' did not return Array"); } |
