Class: RedPack::MsgIdGenerator
- Inherits:
-
Object
- Object
- RedPack::MsgIdGenerator
- Defined in:
- lib/redpack-ruby/clients.rb
Instance Attribute Summary collapse
-
#cur ⇒ Object
Returns the value of attribute cur.
Instance Method Summary collapse
-
#initialize(cur = 1) ⇒ MsgIdGenerator
constructor
A new instance of MsgIdGenerator.
- #next ⇒ Object
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
#cur ⇒ Object
Returns the value of attribute cur.
30 31 32 |
# File 'lib/redpack-ruby/clients.rb', line 30 def cur @cur end |
Instance Method Details
#next ⇒ Object
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 |