class IO::Delimited
Overview
An IO
that wraps another IO
, and only reads up to the beginning of a
specified delimiter.
This is useful for exposing part of an underlying stream to a client.
io = IO::Memory.new "abc||123"
delimited = IO::Delimited.new(io, read_delimiter: "||")
delimited.gets_to_end # => "abc"
delimited.gets_to_end # => ""
io.gets_to_end # => "123"