Class: RBus::Message::SerialGenerator
- Inherits:
-
Object
- Object
- RBus::Message::SerialGenerator
- Includes:
- MonitorMixin, Singleton
- Defined in:
- lib/rbus/message/serial_generator.rb
Overview
Generate a thread-safe, unique serial number for Messages.
Class Method Summary collapse
Instance Method Summary collapse
- #get_next ⇒ Object
-
#initialize ⇒ SerialGenerator
constructor
A new instance of SerialGenerator.
Constructor Details
#initialize ⇒ SerialGenerator
Returns a new instance of SerialGenerator.
34 35 36 37 |
# File 'lib/rbus/message/serial_generator.rb', line 34 def initialize @serial = 0 super end |
Class Method Details
.get_unique ⇒ Object
38 39 40 |
# File 'lib/rbus/message/serial_generator.rb', line 38 def self.get_unique instance.get_next end |
Instance Method Details
#get_next ⇒ Object
41 42 43 44 45 |
# File 'lib/rbus/message/serial_generator.rb', line 41 def get_next synchronize do @serial += 1 end end |