From 4baecc531cde6a6dd1e9c87f53de00a5955b0f5e Mon Sep 17 00:00:00 2001 From: David Haslem Date: Fri, 26 Jul 2013 12:13:12 -0700 Subject: [PATCH] Cleanup suggested by @raggi. --- lib/reel/request.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/reel/request.rb b/lib/reel/request.rb index d032725..4f15564 100644 --- a/lib/reel/request.rb +++ b/lib/reel/request.rb @@ -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 @@ -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