Class: Dbd::Helpers::UUID

Inherits:
Object
  • Object
show all
Defined in:
lib/dbd/helpers/uuid.rb

Overview

A simple UUID implementation based on SecureRandom.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializevoid

Store a SecureRandom.uuid.



20
21
22
# File 'lib/dbd/helpers/uuid.rb', line 20

def initialize
  @uuid = SecureRandom.uuid
end

Class Method Details

.regexpRegexp

A regexp that can be used in tests.

Returns:

  • (Regexp)


13
14
15
# File 'lib/dbd/helpers/uuid.rb', line 13

def self.regexp
  /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
end

Instance Method Details

#to_sString

The to_s of the uuid.

Returns:

  • (String)


27
28
29
# File 'lib/dbd/helpers/uuid.rb', line 27

def to_s
  @uuid.to_s
end