Class: Lite::Uxid::Irreversible::Uuid

Inherits:
Base
  • Object
show all
Defined in:
lib/lite/uxid/irreversible/uuid.rb

Instance Attribute Summary

Attributes inherited from Base

#opts

Instance Method Summary collapse

Methods inherited from Base

decode, #decode, encode, #initialize

Methods included from Base

#decode

Constructor Details

This class inherits a constructor from Lite::Uxid::Irreversible::Base

Instance Method Details

#encodeObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/lite/uxid/irreversible/uuid.rb', line 8

def encode
  encoded_id =
    case coder_version
    when 7
      SecureRandom.uuid_v7
    else
      SecureRandom.uuid
    end

  "#{coder_prefix}#{encoded_id}"
end