Skip to content

Commit

Permalink
Substitute method call by its operation
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed Mar 13, 2012
1 parent b776703 commit adccc64
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/redis/connection/ruby.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def timeout=(timeout)
end end


def read(nbytes) def read(nbytes)
result = _read_from_buffer(nbytes) result = @buffer.slice!(0, nbytes)


while result.bytesize < nbytes while result.bytesize < nbytes
result << _read_from_socket(nbytes - result.bytesize) result << _read_from_socket(nbytes - result.bytesize)
Expand All @@ -43,11 +43,7 @@ def gets
@buffer << _read_from_socket(16384) @buffer << _read_from_socket(16384)
end end


_read_from_buffer(crlf + 2) @buffer.slice!(0, crlf + CRLF.bytesize)
end

def _read_from_buffer(nbytes)
@buffer.slice!(0, nbytes)
end end


def _read_from_socket(nbytes) def _read_from_socket(nbytes)
Expand Down

0 comments on commit adccc64

Please sign in to comment.