struct UID3

Included Modules

Defined in:

uid.cr

Constructors

Instance Method Summary

Constructor Detail

def self.empty : self #

Generates an empty UUID.

UID.empty # => UID3(00000000-0000-4000-0000-000000000000)

[View source]
def self.new(bytes : StaticArray(UInt8, 3)) #

[View source]
def self.new(slice : Slice(UInt8)) #

Creates UUID from 16-bytes slice. Raises if slice isn't 16 bytes long


[View source]
def self.new(value : String) #

Creates new UUID by decoding value string from hyphenated (ie ba714f86-cac6-42c7-8956-bcf5105e1b81), hexstring (ie 89370a4ab66440c8add39e06f2bb6af6) or URN (ie urn:uuid:3f9eaf9e-cdb0-45cc-8ecb-0e5b2bfb0c20) format, raising an ArgumentError if the string does not match any of these formats.


[View source]
def self.new(uuid : UUID) #

Creates another UUID which is a copy of uuid


[View source]
def self.random(random : Random = Random::Secure) : self #

Generates RFC 4122 v4 UUID.

It is strongly recommended to use a cryptographically random source for random, such as Random::Secure.


[View source]

Instance Method Detail

def <=>(other : UUID) : Int32 #

[View source]
def bytes : StaticArray(UInt8, 16) #

Returns the binary representation of the UUID.


[View source]
def hexstring : String #

[View source]
def inspect(io : IO) : Nil #

Convert to String in literal format.


[View source]
def to_s(io : IO) : Nil #
Description copied from struct Struct

Same as #inspect(io).


[View source]
def to_unsafe #

Returns unsafe pointer to 16-bytes.


[View source]