Class: KingKong::Ping::Sequencer

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#countObject (readonly)

Returns the value of attribute count.



109
110
111
# File 'lib/kingkong/ping.rb', line 109

def count
  @count
end

#runObject (readonly)

Returns the value of attribute run.



109
110
111
# File 'lib/kingkong/ping.rb', line 109

def run
  @run
end

Instance Method Details

#nextObject

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