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

Instance Method Details

#add(easy) ⇒ Object

Add an easy to the stack.

Examples:

Add easy.

multi.add(easy)

Parameters:

  • easy (Easy)

    The easy to add.

Raises:



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.

Examples:

Delete easy from stack.

Parameters:

  • easy (Easy)

    The easy to delete.

Raises:



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_handlesArray

Return easy handles.

Examples:

Return easy handles.

multi.easy_handles

Returns:

  • (Array)

    The easy handles.



14
15
16
# File 'lib/ethon/multi/stack.rb', line 14

def easy_handles
  @easy_handles ||= []
end