Module: Ethon::Multi::Stack
- Included in:
- Ethon::Multi
- Defined in:
- lib/ethon/multi/stack.rb
Overview
This module provides the multi stack behaviour.
Instance Method Summary collapse
-
#add(easy) ⇒ Object
Add an easy to the stack.
-
#delete(easy) ⇒ Object
Delete an easy from stack.
-
#easy_handles ⇒ Array
Return easy handles.
Instance Method Details
#add(easy) ⇒ Object
Add an easy to the stack.
26 27 28 29 30 31 32 |
# File 'lib/ethon/multi/stack.rb', line 26 def add(easy) return nil if easy_handles.include?(easy) code = Curl.multi_add_handle(handle, easy.handle) raise Errors::MultiAdd.new(code, easy) unless code == :ok easy_handles << easy end |
#delete(easy) ⇒ Object
Delete an easy from stack.
41 42 43 44 45 46 |
# File 'lib/ethon/multi/stack.rb', line 41 def delete(easy) if easy_handles.delete(easy) code = Curl.multi_remove_handle(handle, easy.handle) raise Errors::MultiRemove.new(code, handle) unless code == :ok end end |
#easy_handles ⇒ Array
Return easy handles.
14 15 16 |
# File 'lib/ethon/multi/stack.rb', line 14 def easy_handles @easy_handles ||= [] end |