class Net::SSH::Buffer

def read_to(pattern)

and including the text that matched the pattern.
immediately after the pattern, if it does match. Returns all data up to
does. Returns nil if nothing matches. Increments the position to point
String, Fixnum, or Regexp and is interpreted exactly as String#index
Reads all data up to and including the given pattern, which may be a
def read_to(pattern)
  index = @content.index(pattern, @position) or return nil
  length = case pattern
           when String then pattern.length
           when Integer then 1
           when Regexp then $&.length
           end
  index && read(index + length)
end