Sha256: 5eb738959d1d9ef0dcf45ac7564f3f11a9499cb9a4576626e54f79dd514a2ead
Contents?: true
Size: 459 Bytes
Versions: 55
Compression:
Stored size: 459 Bytes
Contents
# Microtime based uuids to be sortable class Agilibox::SortableUUIDGenerator REGEX_WITH_DASHES = /^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/ REGEX_WITHOUT_DASHES = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/ def self.call prefix = Time.zone.now.strftime("%s%9N").to_i.to_s(16) suffix = SecureRandom.hex(8) (prefix + suffix).gsub(REGEX_WITHOUT_DASHES, '\1-\2-\3-\4-\5') end end
Version data entries
55 entries across 55 versions & 1 rubygems