summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mrblib/io.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/mrblib/io.rb b/mrblib/io.rb
index 8c4a80924..3ea839379 100644
--- a/mrblib/io.rb
+++ b/mrblib/io.rb
@@ -183,7 +183,7 @@ class IO
nil
end
- def read(length = nil)
+ def read(length = nil, outbuf = "")
unless length.nil?
unless length.is_a? Fixnum
raise TypeError.new "can't convert #{length.class} into Integer"
@@ -215,7 +215,12 @@ class IO
end
end
- array && array.join
+ if array.nil?
+ outbuf.replace("")
+ nil
+ else
+ outbuf.replace(array.join)
+ end
end
def readline(arg = $/, limit = nil)