Class: StompServer::StompId

Inherits:
Object
  • Object
show all
Defined in:
lib/stomp_server/stomp_id.rb

Instance Method Summary collapse

Constructor Details

#initializeStompId

Returns a new instance of StompId.



12
13
14
# File 'lib/stomp_server/stomp_id.rb', line 12

def initialize
  @host = Socket.gethostname.to_s
end

Instance Method Details

#[](id) ⇒ Object



16
17
18
19
# File 'lib/stomp_server/stomp_id.rb', line 16

def [](id)
  msgid = sprintf("%.6f",Time.now.to_f).to_s.sub('.','-')
  msgid = @host + '-' + msgid + '-' + id.to_s
end