This is a Factory for easies to be used in the hydra. Before an easy is ready to be added to a multi, it needs to be prepared and the on_complete callback to be set. This is done by this class.
@api private
Returns the hydra provided.
@return [ Typhoeus::Hydra ]
Returns the request provided.
@return [ Typhoeus::Request ]
Create an easy factory.
@example Create easy factory.
Typhoeus::Hydra::EasyFactory.new(request, hydra)
@param [ Request ] request The request to build an easy for. @param [ Hydra ] hydra The hydra to build an easy for.
# File lib/typhoeus/hydra/easy_factory.rb, line 29 def initialize(request, hydra) @request = request @hydra = hydra end
Return the easy in question.
@example Return easy.
easy_factory.easy
@return [ Ethon::Easy ] The easy.
# File lib/typhoeus/hydra/easy_factory.rb, line 40 def easy @easy ||= hydra.get_easy end
Fabricated and prepared easy.
@example Prepared easy.
easy_factory.get
@return [ Ethon::Easy ] The prepared easy.
# File lib/typhoeus/hydra/easy_factory.rb, line 50 def get easy.http_request( request.url, request.options.fetch(:method, :get), request.options.reject{|k,_| k==:method} ) easy.prepare set_callback easy end