Sha256: 1366cc99e611770346d700d8ba8ec5ec0e4ed33081d211565ba8eb9d398e609c
Contents?: true
Size: 658 Bytes
Versions: 3
Compression:
Stored size: 658 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].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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
em-synchrony-1.0.2 | lib/em-synchrony/em-http.rb |
em-synchrony-1.0.1 | lib/em-synchrony/em-http.rb |
em-synchrony-1.0.0 | lib/em-synchrony/em-http.rb |