Class: URI::URN::UUID

Inherits:
Generic
  • Object
show all
Defined in:
lib/uri/urn/uuid.rb

Constant Summary collapse

NSS_PATTERN =
"[#{PATTERN::HEX}]{8}-[#{PATTERN::HEX}]{4}-[#{PATTERN::HEX}]{4}-[#{PATTERN::HEX}]{4}-[#{PATTERN::HEX}]{12}".freeze

Constants inherited from Generic

Generic::COMPONENT, Generic::NID_PATTERN, Generic::PATTERN, Generic::URN_CHARS_PATTERN, Generic::URN_REGEXP

Instance Attribute Summary

Attributes inherited from Generic

#nid, #nss

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generic

build, #initialize, #opaque=

Constructor Details

This class inherits a constructor from URI::URN::Generic

Class Method Details

.generateObject

Generate UUID and build URI::URN::UUID with it

Currently only version 4 is supported



15
16
17
18
# File 'lib/uri/urn/uuid.rb', line 15

def self.generate
  require 'securerandom' unless defined? SecureRandom
  build(nss: SecureRandom.uuid)
end

Instance Method Details

#normalize!Object



20
21
22
23
# File 'lib/uri/urn/uuid.rb', line 20

def normalize!
  super
  set_nss(self.nss.downcase)
end