Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Cleanup suggested by @raggi.
Browse files Browse the repository at this point in the history
  • Loading branch information
therabidbanana committed Jul 26, 2013
1 parent 8f0c5b8 commit 4baecc5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/reel/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def add_body(chunk)
#
# If no block is given, the entire body will be read from the
# connection into the body buffer and then returned.
def body(&block)
def body
raise "no connection given" unless @connection

if block_given?
# Callback from the http_parser will be calling add_body directly
@on_body = Proc.new(&block)
@on_body = Proc.new

# clear out body buffered so far
yield read_from_body(nil) if @body
Expand Down Expand Up @@ -114,7 +114,7 @@ def read_from_body(length = nil)
unless finished_reading? || @body.length >= length
@connection.readpartial(length - @body.length)
end
slice = @body.slice!(0...length)
slice = @body.slice!(0, length)
end
slice && slice.length == 0 ? nil : slice
end
Expand Down

0 comments on commit 4baecc5

Please sign in to comment.