Class: KingKong::Ping::Deferrable
- Inherits:
-
KingKong::Ping
- Object
- KingKong::Ping
- KingKong::Ping::Deferrable
- Includes:
- EventMachine::Deferrable
- Defined in:
- lib/kingkong/ping.rb
Overview
Add evented functionality to a ping so that it times out, etc.
Constant Summary
Constants inherited from KingKong::Ping
Instance Attribute Summary
Attributes inherited from KingKong::Ping
Instance Method Summary collapse
-
#start ⇒ Object
Setup a ttl for the ping so that it will timeout after ttl seconds.
-
#stop(&block) ⇒ Object
Succeed a block passed into the ping and mark the ping as suceeded.
Methods inherited from KingKong::Ping
#active?, #completed?, default_ttl, #id, #initialize, #latency, #not_started?, sequencer, #status, #timed_out?, #to_hash, #to_s
Constructor Details
This class inherits a constructor from KingKong::Ping
Instance Method Details
#start ⇒ Object
Setup a ttl for the ping so that it will timeout after ttl seconds
132 133 134 135 |
# File 'lib/kingkong/ping.rb', line 132 def start timeout(ttl) # Setup an em TTL on this thing so it fails if the thing isn't called super end |
#stop(&block) ⇒ Object
Succeed a block passed into the ping and mark the ping as suceeded
138 139 140 141 142 |
# File 'lib/kingkong/ping.rb', line 138 def stop(&block) callback(&block) if block_given? super succeed self end |