Sha256: 058ae3fed5713c11edde1bc581201823106f79d195a66716823cc95e1772963c
Contents?: true
Size: 659 Bytes
Versions: 4
Compression:
Stored size: 659 Bytes
Contents
begin require "em-http-request" rescue LoadError => error raise "Missing EM-Synchrony dependency: gem install em-http-request" end module EventMachine module HTTPMethods %w[get head post delete put patch options].each do |type| class_eval %[ alias :a#{type} :#{type} def #{type}(options = {}, &blk) f = Fiber.current conn = setup_request(:#{type}, options, &blk) if conn.error.nil? conn.callback { f.resume(conn) } conn.errback { f.resume(conn) } Fiber.yield else conn end end ] end end end
Version data entries
4 entries across 4 versions & 1 rubygems