Class: RedPack::MsgIdGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/redpack-ruby/clients.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cur = 1) ⇒ MsgIdGenerator

Returns a new instance of MsgIdGenerator.



32
33
34
# File 'lib/redpack-ruby/clients.rb', line 32

def initialize(cur=1)
  @cur = cur
end

Instance Attribute Details

#curObject

Returns the value of attribute cur.



30
31
32
# File 'lib/redpack-ruby/clients.rb', line 30

def cur
  @cur
end

Instance Method Details

#nextObject



36
37
38
39
40
41
42
43
# File 'lib/redpack-ruby/clients.rb', line 36

def next
  if @cur < Integer::MAX then
    @cur = @cur.succ
  else
    @cur = 1
  end
  return @cur
end