Module: Unbound::CallbacksMixin
Instance Method Summary collapse
-
#on_answer(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called when we receive an answer to the query.
-
#on_cancel(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called if the query times out (dependant on the resolver).
-
#on_error(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called when an error internal to unbound occurs.
-
#on_finish(*cbs, &cb_block) ⇒ Object
Adds a callback will always be called when the query is finished whether answerfully, in error, or due to cancel.
-
#on_start(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called just after the query is sent.
Instance Method Details
#on_answer(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called when we receive an answer to the query
30 31 32 |
# File 'lib/unbound/callbacks_mixin.rb', line 30 def on_answer(*cbs, &cb_block) @callbacks_answer.add_callback(*cbs, &cb_block) end |
#on_cancel(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called if the query times out (dependant on the resolver)
43 44 45 |
# File 'lib/unbound/callbacks_mixin.rb', line 43 def on_cancel(*cbs, &cb_block) @callbacks_cancel.add_callback(*cbs, &cb_block) end |
#on_error(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called when an error internal to unbound occurs
36 37 38 |
# File 'lib/unbound/callbacks_mixin.rb', line 36 def on_error(*cbs, &cb_block) @callbacks_error.add_callback(*cbs, &cb_block) end |
#on_finish(*cbs, &cb_block) ⇒ Object
Adds a callback will always be called when the query is finished whether answerfully, in error, or due to cancel.
50 51 52 |
# File 'lib/unbound/callbacks_mixin.rb', line 50 def on_finish(*cbs, &cb_block) @callbacks_finish.add_callback(*cbs, &cb_block) end |
#on_start(*cbs, &cb_block) ⇒ Object
Adds a callback that will be called just after the query is sent
24 25 26 |
# File 'lib/unbound/callbacks_mixin.rb', line 24 def on_start(*cbs, &cb_block) @callbacks_start.add_callback(*cbs, &cb_block) end |