This is a Factory for easies to be used in the hydra. Before an easy is ready to be added to a multi the on_complete callback to be set. This is done by this class.
@api private
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/easy_factory.rb, line 28 def initialize(request, hydra = nil) @request = request @hydra = hydra end
Return the easy in question.
@example Return easy.
easy_factory.easy
@return [ Ethon::Easy ] The easy.
# File lib/typhoeus/easy_factory.rb, line 39 def easy @easy ||= Typhoeus::Pool.get end
Fabricated easy.
@example Prepared easy.
easy_factory.get
@return [ Ethon::Easy ] The easy.
# File lib/typhoeus/easy_factory.rb, line 49 def get begin easy.http_request( request.base_url, request.options.fetch(:method, :get), request.options.reject{ |k,_| [:method, :cache_ttl].include?(k) } ) rescue Ethon::Errors::InvalidOption => e help = provide_help(e.message.match(/:\s(\w+)/)[1]) raise $!, "#{$!}#{help}", $!.backtrace end set_callback easy end
Generated with the Darkfish Rdoc Generator 2.