Module | Typhoeus::Request::Callbacks |
In: |
lib/typhoeus/request/callbacks.rb
|
This module contains the logic for the response callbacks.
You can set multiple callbacks, which are then executed in the same order.
request.on_complete { |response| p 1 } request.on_complete { |response| p 2 } request.execute_callbacks #=> 1 #=> 2
You can clear the callbacks:
request.on_complete { |response| p 1 } request.on_complete { |response| p 2 } request.on_complete.clear request.execute_callbacks #=> nil
@note If you‘re using the Hydra to execute multiple
requests, then callbacks are delaying the request execution.
Execute necessary callback and yields response. This include in every case on_complete and on_progress, on_success if successful and on_failure if not.
@example Execute callbacks.
request.execute_callbacks
@return [ void ]
@api private