Module: Typhoeus
- Defined in:
- lib/typhoeus.rb,
lib/typhoeus/curl.rb,
lib/typhoeus/easy.rb,
lib/typhoeus/form.rb,
lib/typhoeus/hydra.rb,
lib/typhoeus/multi.rb,
lib/typhoeus/utils.rb,
lib/typhoeus/filter.rb,
lib/typhoeus/header.rb,
lib/typhoeus/remote.rb,
lib/typhoeus/request.rb,
lib/typhoeus/version.rb,
lib/typhoeus/easy/ssl.rb,
lib/typhoeus/response.rb,
lib/typhoeus/easy/auth.rb,
lib/typhoeus/easy/infos.rb,
lib/typhoeus/easy/proxy.rb,
lib/typhoeus/hydra_mock.rb,
lib/typhoeus/easy/options.rb,
lib/typhoeus/remote_method.rb,
lib/typhoeus/easy/callbacks.rb,
lib/typhoeus/hydra/stubbing.rb,
lib/typhoeus/easy/ffi_helper.rb,
lib/typhoeus/hydra/callbacks.rb,
lib/typhoeus/param_processor.rb,
lib/typhoeus/remote_proxy_object.rb,
lib/typhoeus/hydra/connect_options.rb
Defined Under Namespace
Modules: ClassMethods, Curl, EasyFu, Utils
Classes: Easy, Filter, Form, Header, Hydra, HydraMock, MockExpectedError, Multi, ParamProcessor, RemoteMethod, RemoteProxyObject, Request, Response
Constant Summary
collapse
- USER_AGENT =
"Typhoeus - http://github.com/dbalatero/typhoeus/tree/master"
- VERSION =
'0.4.0'
Class Method Summary
collapse
Class Method Details
.add_easy_request(easy_object) ⇒ Object
44
45
46
47
|
# File 'lib/typhoeus.rb', line 44
def self.add_easy_request(easy_object)
Thread.current[:curl_multi] ||= Typhoeus::Multi.new
Thread.current[:curl_multi].add(easy_object)
end
|
.easy_object_pool ⇒ Object
21
22
23
|
# File 'lib/typhoeus.rb', line 21
def self.easy_object_pool
@easy_objects ||= []
end
|
.get_easy_object ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/typhoeus.rb', line 36
def self.get_easy_object
if easy_object_pool.empty?
Typhoeus::Easy.new
else
easy_object_pool.pop
end
end
|
.included(base) ⇒ Object
4
5
6
|
# File 'lib/typhoeus/remote.rb', line 4
def self.included(base)
base.extend ClassMethods
end
|
.init_easy_object_pool ⇒ Object
25
26
27
28
29
|
# File 'lib/typhoeus.rb', line 25
def self.init_easy_object_pool
20.times do
easy_object_pool << Typhoeus::Easy.new
end
end
|
49
50
51
52
53
54
55
56
|
# File 'lib/typhoeus.rb', line 49
def self.perform_easy_requests
multi = Thread.current[:curl_multi]
start_time = Time.now
multi.easy_handles.each do |easy|
easy.start_time = start_time
end
multi.perform
end
|
.release_easy_object(easy) ⇒ Object
31
32
33
34
|
# File 'lib/typhoeus.rb', line 31
def self.release_easy_object(easy)
easy.reset
easy_object_pool << easy
end
|