lib/hatetepe/body.rb in hatetepe-0.3.1 vs lib/hatetepe/body.rb in hatetepe-0.4.0
- old
+ new
@@ -1,9 +1,11 @@
require "em-synchrony"
require "eventmachine"
require "stringio"
+require "hatetepe/deferred_status_fix"
+
module Hatetepe
# Thin wrapper around StringIO for asynchronous body processing.
class Body
include EM::Deferrable
@@ -156,12 +158,12 @@
#
# @return [Fixnum]
# The number of bytes written.
def write(data)
ret = io.write data
- Fiber.new do
- @receivers.each {|r| r.call data }
- end.resume
+ @receivers.each do |r|
+ Fiber.new { r.call data }.resume
+ end
ret
end
end
end