Sha256: 20c8d4b5717260759901a6f4a91f90cf9af47e05cd932f6aee45c017da680293
Contents?: true
Size: 458 Bytes
Versions: 46
Compression:
Stored size: 458 Bytes
Contents
require "securerandom" module Fog class UUID class << self def uuid if supported? SecureRandom.uuid else ary = SecureRandom.random_bytes(16).unpack("NnnnnN") ary[2] = (ary[2] & 0x0fff) | 0x4000 ary[3] = (ary[3] & 0x3fff) | 0x8000 "%08x-%04x-%04x-%04x-%04x%08x" % ary end end def supported? SecureRandom.respond_to?(:uuid) end end end end
Version data entries
46 entries across 43 versions & 3 rubygems