lib/hatetepe/body.rb in hatetepe-0.3.0 vs lib/hatetepe/body.rb in hatetepe-0.3.1

- old
+ new

@@ -96,11 +96,11 @@ # Yields incoming body data. # # Immediately yields all data that has already arrived. Blocks until the # Body is write-closed and yields for each call to #write until then. # - # @yield [String] Block to execute for each incoming data chunk + # @yield [String] Block to execute for each incoming data chunk. # # @return [undefined] def each(&block) @receivers << block block.call io.string.dup unless io.string.empty? @@ -150,18 +150,18 @@ # # Appends the given String to the underlying StringIO annd returns the # number of bytes written. # # @param [String] data - # The data to append + # The data to append. # # @return [Fixnum] # The number of bytes written. def write(data) ret = io.write data - Fiber.new { + Fiber.new do @receivers.each {|r| r.call data } - }.resume + end.resume ret end end end