struct

UUID

Inherits Comparable / Struct / Value / Object

Represents a UUID (Universally Unique IDentifier).

NOTE: To use UUID, you must explicitly import it with require "uuid"

Constructors

new(pull : CBOR::Decoder)

Creates UUID from CBOR using CBOR::Decoder.

require "cbor"

class Example
  include CBOR::Serializable

  property id : UUID
end

hash = {"id" => "ba714f86-cac6-42c7-8956-bcf5105e1b81"}
example = Example.from_cbor hash.to_cbor
example.id # => UUID(ba714f86-cac6-42c7-8956-bcf5105e1b81)
Source

Instance methods

to_cbor(cbor : CBOR::Encoder)

Returns UUID as CBOR value.

uuid = UUID.new("87b3042b-9b9a-41b7-8b15-a93d3f17025e")
uuid.to_cbor
Source