lib/sse_client/streaming_http.rb
# Extract the next line of text from the read buffer, refilling the buffer as needed.
Extract the next line of text from the read buffer, refilling the buffer as needed.
Extract the next line of text from the read buffer refilling the buffer as needed .
def read_line
      loop do
        @lock.synchronize do
          i = @buffer.index(/[\r\n]/)
          if !i.nil?
            i += 1 if (@buffer[i] == "\r" && i < @buffer.length - 1 && @buffer[i + 1] == "\n")
            return @buffer.slice!(0, i + 1).force_encoding(Encoding::UTF_8)
          end
        end
        return nil if !read_chunk_into_buffer
      end
    end
def read_line loop do @lock . synchronize do i = @buffer . index ( / [ \r \n ] / ) if ! i . nil? i += 1 if ( @buffer [ i ] == "\r" && i < @buffer . length - 1 && @buffer [ i + 1 ] == "\n" ) return @buffer . slice! ( 0 , i + 1 ) . force_encoding ( Encoding :: UTF_8 ) end end return nil if ! read_chunk_into_buffer end end
Extract the next line of text from the read buffer, refilling the buffer as needed.
Extract the next line of text from the read buffer refilling the buffer as needed .