Module: EventMachine::UuidGenerator

Defined in:
lib/em/pure_ruby.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

.generateObject



235
236
237
238
239
240
241
242
243
244
245
# File 'lib/em/pure_ruby.rb', line 235

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

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

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