class IO::Stream::Buffered
def self.wrap(io, **options)
def self.wrap(io, **options) if io.respond_to?(:buffered=) io.buffered = false elsif io.respond_to?(:sync=) io.sync = true end stream = self.new(io, **options) return stream unless block_given? begin yield stream ensure stream.close end end