Sha256: 87874f89069125720341c0f9b5f348ed1fa62574b0607b625708e96810e424dc

Contents?: true

Size: 431 Bytes

Versions: 1

Compression:

Stored size: 431 Bytes

Contents

module EventMachine
  class HttpRequest
     %w[get head post delete put].each do |type|
       class_eval %[
         alias :a#{type} :#{type}
         def #{type}(options = {}, &blk)
           f = Fiber.current

            conn = setup_request(:#{type}, options, &blk)
            conn.callback { f.resume(conn) }
            conn.errback  { f.resume(conn) }

            Fiber.yield  
         end
      ]
    end  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-synchrony-0.1.1 lib/em-synchrony/em-http.rb