Module: EventMachine::UuidGenerator

Defined in:
lib/pr_eventmachine.rb

Overview

Factored out so we can substitute other implementations here if desired, such as the one in ActiveRBAC.

Class Method Summary collapse

Class Method Details

.generate ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
# File 'lib/pr_eventmachine.rb', line 229

def self.generate
  if @ix and @ix >= 10000
    @ix = nil
    @seed = nil
  end

  @seed ||= `uuidgen`.chomp.gsub(/-/,"")
  @ix ||= 0

  "#{@seed}#{@ix += 1}"
end