Class: KingKong::Ping::Sequencer
- Inherits:
-
Object
- Object
- KingKong::Ping::Sequencer
- Defined in:
- lib/kingkong/ping.rb
Overview
Keeps track of the results heading in/out. We could just use some totally random GUID instead of bothering with this, but having a 1,2,3… sequence makes it much easier to spot check tests to verify whether or not messages are being sent correctly.
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#run ⇒ Object
readonly
Returns the value of attribute run.
Instance Method Summary collapse
-
#initialize(run = Time.now.to_i) ⇒ Sequencer
constructor
A new instance of Sequencer.
-
#next ⇒ Object
Tick up the restul count and give us the key.
Constructor Details
#initialize(run = Time.now.to_i) ⇒ Sequencer
Returns a new instance of Sequencer.
111 112 113 |
# File 'lib/kingkong/ping.rb', line 111 def initialize(run=Time.now.to_i) @run, @count = run, 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
109 110 111 |
# File 'lib/kingkong/ping.rb', line 109 def count @count end |
#run ⇒ Object (readonly)
Returns the value of attribute run.
109 110 111 |
# File 'lib/kingkong/ping.rb', line 109 def run @run end |
Instance Method Details
#next ⇒ Object
Tick up the restul count and give us the key
116 117 118 |
# File 'lib/kingkong/ping.rb', line 116 def next key @count += 1 end |