class Typhoeus::Hydra::EasyFactory
@api private
This is done by this class.
on_complete callback to be set.
Before an easy is ready to be added to a multi the
This is a Factory for easies to be used in the hydra.
def easy
-
(Ethon::Easy)
- The easy.
Other tags:
- Example: Return easy. -
def easy @easy ||= hydra.get_easy end
def get
-
(Ethon::Easy)
- The easy.
Other tags:
- Example: Prepared easy. -
def get easy.http_request( request.url, request.options.fetch(:method, :get), request.options.reject{|k,_| k==:method} ) set_callback easy end
def initialize(request, hydra)
-
hydra
(Hydra
) -- The hydra to build an easy for. -
request
(Request
) -- The request to build an easy for.
Other tags:
- Example: Create easy factory. -
def initialize(request, hydra) @request = request @hydra = hydra end
def set_callback
-
(Ethon::Easy)
- The easy.
Other tags:
- Example: Set callback. -
def set_callback easy.on_complete do |easy| request.finish(Response.new(easy.to_hash)) hydra.release_easy(easy) hydra.queue(hydra.queued_requests.shift) unless hydra.queued_requests.empty? end end