ruby / stringio

Pseudo `IO` class from/to `String`.
BSD 2-Clause "Simplified" License
36 stars 26 forks source link

StringIO#pread: handle 0 length like IO#pread #67

Closed casperisfine closed 1 year ago

casperisfine commented 1 year ago

Fix: https://github.com/ruby/stringio/issues/66

If length is 0, IO#pread don't even try to read the IO, it simply return the buffer untouched if there is one or a new empty buffer otherwise.

It also doesn't validate the offset when length is 0.

cc @jdelStrother @kou

kou commented 1 year ago

Thanks!

jdelStrother commented 1 year ago

Thanks both!