Unverified Commit 1ebe1c8b authored by ksss's avatar ksss

Support outbuf argument for IO#read

parent 3a73a584
...@@ -181,7 +181,7 @@ class IO ...@@ -181,7 +181,7 @@ class IO
nil nil
end end
def read(length = nil) def read(length = nil, outbuf = "")
unless length.nil? unless length.nil?
unless length.is_a? Fixnum unless length.is_a? Fixnum
raise TypeError.new "can't convert #{length.class} into Integer" raise TypeError.new "can't convert #{length.class} into Integer"
...@@ -217,7 +217,12 @@ class IO ...@@ -217,7 +217,12 @@ class IO
end end
end end
array && array.join if array.nil?
outbuf.replace("")
nil
else
outbuf.replace(array.join)
end
end end
def readline(arg = $/, limit = nil) def readline(arg = $/, limit = nil)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment