Sha256: c7489c81a09219c3d63c7a22164f66294a3e0c0b6f76bbcd2b21bfa93906980d

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

begin
  require "em-http"
rescue LoadError => error
  raise "Missing EM-Synchrony dependency: gem install em-http-request"
end

module EventMachine
  module HTTPMethods
     %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.3.0.beta.1 lib/em-synchrony/em-http.rb