class EmmyExtends::HTTPI::Operation
Attributes
connection[R]
http[R]
request[R]
response[R]
Public Class Methods
new(http)
click to toggle source
# File lib/emmy_extends/httpi/operation.rb, line 12 def initialize(http) @http = http @request = http.request setup end
Public Instance Methods
code()
click to toggle source
# File lib/emmy_extends/httpi/operation.rb, line 52 def code 0 end
connect()
click to toggle source
# File lib/emmy_extends/httpi/operation.rb, line 18 def connect http.connect end
follow_redirect?()
click to toggle source
# File lib/emmy_extends/httpi/operation.rb, line 56 def follow_redirect? false end
setup()
click to toggle source
# File lib/emmy_extends/httpi/operation.rb, line 37 def setup http.on :init do |connection| @connection = connection end http.on :success do |res, http, conn| @response = ::HTTPI::Response.new(*res) success!(response, self, conn) end http.on :error do |error, http, conn| error!(error, self, conn) end end
sync()
click to toggle source
# File lib/emmy_extends/httpi/operation.rb, line 22 def sync Fiber.sync do |fiber| connect on :success do |response, operation, conn| fiber.resume response end on :error do |error, operation, conn| # FIXME: TimeoutError separate fiber.leave EmmyHttp::ConnectionError, error.to_s end end end