summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-18 08:40:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-18 08:40:33 +0000
commit74097260aeac51cb2839d90f5cf7eb4c84c9124f (patch)
tree4b2f781b6af183d2eb4bab2fce876d6addc021d3 /io.c
parentb49f3b26e5d96c22f3ccb578a5bef3dbff8f7dba (diff)
* eval.c (rb_thread_schedule): should not select a thread which is
not yet initialized. * variable.c (find_class_path): should initialize iv_tbl if it's NULL. * class.c (rb_define_class): should return the existing class if the class is already defined and its superclass is ideintical to the specified superclass. * class.c (rb_define_class_under): ditto. * class.c (rb_define_module): should return the existing module if the module is already defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/io.c b/io.c
index 950d3fa1c6..2aeb43467a 100644
--- a/io.c
+++ b/io.c
@@ -2134,18 +2134,17 @@ rb_io_puts(argc, argv, out)
return Qnil;
}
for (i=0; i<argc; i++) {
- switch (TYPE(argv[i])) {
- case T_NIL:
+ if (NIL_P(argv[i])) {
line = rb_str_new2("nil");
- break;
- case T_ARRAY:
- rb_protect_inspect(io_puts_ary, argv[i], out);
- continue;
- default:
- line = argv[i];
- break;
}
- line = rb_obj_as_string(line);
+ else {
+ line = rb_check_convert_type(argv[i], T_ARRAY, "Array", "to_ary");
+ if (!NIL_P(line)) {
+ rb_protect_inspect(io_puts_ary, line, out);
+ continue;
+ }
+ line = rb_obj_as_string(argv[i]);
+ }
rb_io_write(out, line);
if (RSTRING(line)->ptr[RSTRING(line)->len-1] != '\n') {
rb_io_write(out, rb_default_rs);