class Net::SSH::Buffer

def read_all(&block)

Calls block(self) until the buffer is empty, and returns all results.
def read_all(&block)
  Enumerator.new { |e| e << yield(self) until eof? }.to_a
end