summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-io/mrblib/io.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-04-30 23:47:47 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-05-01 00:00:14 +0900
commit8f362eaf8a49af23c2c68d7d84b24c5211578881 (patch)
tree35ec754e7b9cadb1889c315352aaf351b75ffe4c /mrbgems/mruby-io/mrblib/io.rb
parent519dc3d19c355e53f3fa539da1696b6f4c40d87d (diff)
downloadmruby-8f362eaf8a49af23c2c68d7d84b24c5211578881.tar.gz
mruby-8f362eaf8a49af23c2c68d7d84b24c5211578881.zip
io.rb,print.rb: `puts` to expand array arguments.
As CRuby behaves.
Diffstat (limited to 'mrbgems/mruby-io/mrblib/io.rb')
-rw-r--r--mrbgems/mruby-io/mrblib/io.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/mrbgems/mruby-io/mrblib/io.rb b/mrbgems/mruby-io/mrblib/io.rb
index 8f81c5f3a..645733226 100644
--- a/mrbgems/mruby-io/mrblib/io.rb
+++ b/mrbgems/mruby-io/mrblib/io.rb
@@ -360,9 +360,14 @@ class IO
i = 0
len = args.size
while i < len
- s = args[i].to_s
- write s
- write "\n" if (s[-1] != "\n")
+ s = args[i]
+ if s.kind_of?(Array)
+ puts(*s)
+ else
+ s = s.to_s
+ write s
+ write "\n" if (s[-1] != "\n")
+ end
i += 1
end
write "\n" if len == 0