lib/hatetepe/body.rb in hatetepe-0.2.0 vs lib/hatetepe/body.rb in hatetepe-0.2.1

- old
+ new

@@ -52,28 +52,30 @@ sync end def read(*args) sync - rewind @io.read *args end def gets sync - rewind @io.gets end def write(chunk) ret = @io.write chunk - @receivers.each {|r| r.call chunk } + Fiber.new { + @receivers.each {|r| r.call chunk } + }.resume ret end def <<(chunk) ret = @io << chunk - @receivers.each {|r| r.call chunk } + Fiber.new { + @receivers.each {|r| r.call chunk } + }.resume ret end end end