class IO::Sized
Overview
An IO
that wraps another IO
, setting a limit for the number of bytes that can be read.
io = IO::Memory.new "abcde"
sized = IO::Sized.new(io, read_size: 3)
sized.gets_to_end # => "abc"
sized.gets_to_end # => ""
io.gets_to_end # => "de"