Module: SecureRandom

Defined in:
lib/activefacts/api/guid.rb

Class Method Summary collapse

Class Method Details

.format_uuid(hex32) ⇒ Object



5
6
7
8
9
10
# File 'lib/activefacts/api/guid.rb', line 5

def self.format_uuid hex32
  hex32.sub(
    @@format_pattern ||= /(........)(....)(....)(....)(............)/,
    @@format_string ||= '\1-\2-\3-\4-\5'
  )
end

.uuidObject

I think this only applies to 1.8.6 (and JRuby/Rubinius in 1.8 mode) now:



15
16
17
# File 'lib/activefacts/api/guid.rb', line 15

def SecureRandom.uuid
  format_uuid(hex(16))
end