Module: Typhoeus
- Defined in:
- lib/typhoeus.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/remote.rb,
lib/typhoeus/request.rb,
lib/typhoeus/service.rb,
lib/typhoeus/version.rb,
lib/typhoeus/response.rb,
lib/typhoeus/hydra_mock.rb,
lib/typhoeus/remote_method.rb,
lib/typhoeus/hydra/stubbing.rb,
lib/typhoeus/hydra/callbacks.rb,
lib/typhoeus/param_processor.rb,
lib/typhoeus/remote_proxy_object.rb,
lib/typhoeus/hydra/connect_options.rb,
lib/typhoeus/normalized_header_hash.rb
Defined Under Namespace
Modules: ClassMethods, Utils
Classes: Easy, Filter, Form, Hydra, HydraMock, MockExpectedError, Multi, NormalizedHeaderHash, ParamProcessor, RemoteMethod, RemoteProxyObject, Request, Response, Service
Constant Summary
collapse
- USER_AGENT =
"Typhoeus - http://github.com/dbalatero/typhoeus/tree/master"
- VERSION =
'0.3.7'
Class Method Summary
collapse
Class Method Details
.add_easy_request(easy_object) ⇒ Object
46
47
48
49
|
# File 'lib/typhoeus.rb', line 46
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
23
24
25
|
# File 'lib/typhoeus.rb', line 23
def self.easy_object_pool
@easy_objects ||= []
end
|
.get_easy_object ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/typhoeus.rb', line 38
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
27
28
29
30
31
|
# File 'lib/typhoeus.rb', line 27
def self.init_easy_object_pool
20.times do
easy_object_pool << Typhoeus::Easy.new
end
end
|
51
52
53
54
55
56
57
58
|
# File 'lib/typhoeus.rb', line 51
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
33
34
35
36
|
# File 'lib/typhoeus.rb', line 33
def self.release_easy_object(easy)
easy.reset
easy_object_pool << easy
end
|