Generate UUIDs with UUIDTools::UUID
mainThe UUIDTools::UUID class provides several methods to generate different types of UUIDs conforming to RFC 4122. You can create UUIDs based on MD5 or SHA1 hashes using a namespace, generate timestamp-based UUIDs, or generate random UUIDs.
require "uuidtools"
# Create an MD5-based UUID using a namespace
UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
# Create a SHA1-based UUID using a namespace
UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
# Create a timestamp-based UUID
UUIDTools::UUID.timestamp_create
# Create a random UUID
UUIDTools::UUID.random_create