Sha256: 395590e7746b04206c54f2a77a03be90172488359859fdb2381dee64490f34e4
Contents?: true
Size: 686 Bytes
Versions: 20
Compression:
Stored size: 686 Bytes
Contents
module ASIR # Provides an RFC4122-compliant random (version 4) UUID service. module UUID # Return an RFC4122-compliant random (version 4) UUID, # represented as a string of 36 characters. # # Possible (but unlikely!) return value: # "e29fc859-8d6d-4c5d-aa5a-1ab726f4a192". # # Possible exceptions: # Errno::ENOENT # PROC_SYS_FILE = "/proc/sys/kernel/random/uuid".freeze case when File.exist?(PROC_SYS_FILE) def self.generate File.read(PROC_SYS_FILE).chomp! end when (gem 'uuid' rescue nil) require 'uuid' def self.generate ::UUID.generate end else def self.generate raise "Unimplemented" end end end end
Version data entries
20 entries across 20 versions & 1 rubygems