diff options
| -rw-r--r-- | mrblib/io.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mrblib/io.rb b/mrblib/io.rb index 694fdb0c9..4262504f2 100644 --- a/mrblib/io.rb +++ b/mrblib/io.rb @@ -181,7 +181,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" @@ -217,7 +217,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) |
