| Module | Ethon::Easy::ResponseCallbacks |
| In: |
lib/ethon/easy/response_callbacks.rb
|
This module contains the logic for the response callbacks. The on_complete callback is the only one at the moment.
You can set multiple callbacks, which are then executed in the same order.
easy.on_complete { p 1 }
easy.on_complete { p 2 }
easy.complete
#=> 1
#=> 2
You can clear the callbacks:
easy.on_complete { p 1 }
easy.on_complete { p 2 }
easy.on_complete.clear
easy.on_complete
#=> []
Set on_complete callback.
@example Set on_complete.
request.on_complete { p "yay" }
@param [ Block ] block The block to execute.
Set on_headers callback.
@example Set on_headers.
request.on_headers { p "yay" }
@param [ Block ] block The block to execute.
Set on_progress callback.
@example Set on_progress.
request.on_progress {|dltotal, dlnow, ultotal, ulnow| p "#{dltotal} #{dlnow} #{ultotal} #{ulnow}" }
@param [ Block ] block The block to execute.