summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-28 06:34:02 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-28 06:34:02 +0000
commit703532aa1c71addb3640d597c86f17c4e7feeb48 (patch)
tree54a1eb931ad401f9842cb57c8df6a86f84457f89 /object.c
parenta77bb6b7a761ed7cab8e615284ef7344a571b8f4 (diff)
* lib/cgi.rb (CGI::Cookie::initialize): use Array() again.
[ruby-core:09781] * object.c (rb_Array): returns 1-element array if the argument does not have to_ary nor to_a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/object.c b/object.c
index b5f183fbf9..78e930ff38 100644
--- a/object.c
+++ b/object.c
@@ -2148,7 +2148,7 @@ rb_String(VALUE val)
* <code>to_s</code> method.
*
* String(self) #=> "main"
- * String(self.class #=> "Object"
+ * String(self.class) #=> "Object"
* String(123456) #=> "123456"
*/
@@ -2164,7 +2164,10 @@ rb_Array(VALUE val)
VALUE tmp = rb_check_array_type(val);
if (NIL_P(tmp)) {
- return rb_convert_type(val, T_ARRAY, "Array", "to_a");
+ tmp = rb_check_convert_type(val, T_ARRAY, "Array", "to_a");
+ if (NIL_P(tmp)) {
+ return rb_ary_new3(1, val);
+ }
}
return tmp;
}