Method: Net::BufferedIO#readuntil

Defined in:
lib/net/protocol.rb

#readuntil(terminator, ignore_eof = false) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/net/protocol.rb', line 113

def readuntil(terminator, ignore_eof = false)
  begin
    until idx = @rbuf.index(terminator)
      rbuf_fill
    end
    return rbuf_consume(idx + terminator.size)
  rescue EOFError
    raise unless ignore_eof
    return rbuf_consume(@rbuf.size)
  end
end