Class: Gitlab::UUID

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

Constant Summary collapse

NAMESPACE_IDS =
{
  development: "a143e9e2-41b3-47bc-9a19-081d089229f4",
  test: "a143e9e2-41b3-47bc-9a19-081d089229f4",
  staging: "a6930898-a1b2-4365-ab18-12aa474d9b26",
  production: "58dc0f06-936c-43b3-93bb-71693f1b6570"
}.freeze
UUID_V5_PATTERN =
/\h{8}-\h{4}-5\h{3}-\h{4}-\h{12}/.freeze
NAMESPACE_REGEX =
/(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})/.freeze
PACK_PATTERN =
"NnnnnN"

Class Method Summary collapse

Class Method Details

.v5(name, namespace_id: default_namespace_id) ⇒ Object


17
18
19
# File 'lib/gitlab/uuid.rb', line 17

def v5(name, namespace_id: default_namespace_id)
  Digest::UUID.uuid_v5(namespace_id, name)
end

.v5?(string) ⇒ Boolean

Returns:

  • (Boolean)

21
22
23
# File 'lib/gitlab/uuid.rb', line 21

def v5?(string)
  string.match(UUID_V5_PATTERN).present?
end