Class: IOPromise::Faraday::ContinuableHydra

Inherits:
Typhoeus::Hydra
  • Object
show all
Defined in:
lib/iopromise/faraday/continuable_hydra.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ContinuableHydra

Returns a new instance of ContinuableHydra.



15
16
17
18
19
# File 'lib/iopromise/faraday/continuable_hydra.rb', line 15

def initialize(options = {})
  super(options)
  
  @multi = MultiSocketAction.new(options.reject{|k,_| k==:max_concurrency})
end

Class Method Details

.for_current_threadObject



10
11
12
# File 'lib/iopromise/faraday/continuable_hydra.rb', line 10

def for_current_thread
  Thread.current[:faraday_promise_typhoeus_hydra] ||= new
end

Instance Method Details

#execute_continueObject



29
30
31
32
33
34
# File 'lib/iopromise/faraday/continuable_hydra.rb', line 29

def execute_continue
  # fill up the curl easy handle as much as possible
  dequeue_many
    
  @multi.execute_continue
end

#iop_handler=(iop_handler) ⇒ Object



21
22
23
# File 'lib/iopromise/faraday/continuable_hydra.rb', line 21

def iop_handler=(iop_handler)
  @multi.iop_handler = iop_handler
end

#socket_is_ready(io, readable, writable) ⇒ Object



25
26
27
# File 'lib/iopromise/faraday/continuable_hydra.rb', line 25

def socket_is_ready(io, readable, writable)
  @multi.socket_is_ready(io, readable, writable)
end