Class: Ethon::Multi
- Inherits:
-
Object
- Object
- Ethon::Multi
- Includes:
- Operations, Options, Stack
- Defined in:
- lib/ethon/multi.rb,
lib/ethon/multi/stack.rb,
lib/ethon/multi/options.rb,
lib/ethon/multi/operations.rb
Overview
:nodoc
Defined Under Namespace
Modules: Operations, Options, Stack
Constant Summary
Constants included from Operations
Operations::PERFORMED_MULTI, Operations::STARTED_MULTI
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Multi
constructor
Create a new multi.
-
#set_attributes(options) ⇒ Object
private
Set given options.
Methods included from Options
#max_total_connections=, #maxconnects=, #pipelining=, #socketdata=, #socketfunction=, #timerdata=, #timerfunction=
Methods included from Operations
#handle, #init_vars, #ongoing?, #perform, #prepare, #socket_action
Methods included from Stack
Constructor Details
#initialize(options = {}) ⇒ Multi
Create a new multi. Initialize curl in case it didn’t happen before.
Pass a long. The set number will be used as the maximum amount of simultaneously open connections in total. For each new session, libcurl will open a new connection up to the limit set by CURLMOPT_MAX_TOTAL_CONNECTIONS. When the limit is reached, the sessions will be pending until there are available connections. If CURLMOPT_PIPELINING is 1, libcurl will try to pipeline if the host is capable of it. The default value is 0, which means that there is no limit. However, for backwards compatibility, setting it to 0 when CURLMOPT_PIPELINING is 1 will not be treated as unlimited. Instead it will open only 1 connection and try to pipeline on it. (Added in 7.30.0)
89 90 91 92 93 94 |
# File 'lib/ethon/multi.rb', line 89 def initialize( = {}) Curl.init @execution_mode = .delete(:execution_mode) || :perform set_attributes() init_vars end |
Instance Method Details
#set_attributes(options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set given options.
106 107 108 109 110 111 112 113 |
# File 'lib/ethon/multi.rb', line 106 def set_attributes() .each_pair do |key, value| unless respond_to?("#{key}=") raise Errors::InvalidOption.new(key) end method("#{key}=").call(value) end end |