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
Class Method Summary collapse
-
.finalizer(multi) ⇒ Object
Frees the libcurl multi handle.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Multi
constructor
Create a new multi.
-
#set_attributes(options) ⇒ Object
Set given options.
Methods included from Options
included, #set_options, #value_for
Methods included from Operations
#check, #get_timeout, #handle, #init_vars, #ongoing?, #perform, #prepare, #reset_fds, #run, #running_count, #set_fds, #trigger
Methods included from Stack
Constructor Details
#initialize(options = {}) ⇒ Multi
Create a new multi. Initialize curl in case it didn’t happen before.
80 81 82 83 84 85 |
# File 'lib/ethon/multi.rb', line 80 def initialize( = {}) Curl.init ObjectSpace.define_finalizer(self, self.class.finalizer(self)) set_attributes() init_vars end |
Class Method Details
.finalizer(multi) ⇒ Object
Frees the libcurl multi handle.
21 22 23 24 25 |
# File 'lib/ethon/multi.rb', line 21 def finalizer(multi) proc { Curl.multi_cleanup(multi.handle) } end |
Instance Method Details
#set_attributes(options) ⇒ Object
Set given options.
95 96 97 98 99 100 101 102 |
# File 'lib/ethon/multi.rb', line 95 def set_attributes() .each_pair do |key, value| unless respond_to?("#{key}=") raise Errors::InvalidOption.new(key) end method("#{key}=").call(value) end end |