Sha256: 740ac4b4f253847c80f6fd17eb9a360f4b5921184aa0c844d00fff14aaa374ac
Contents?: true
Size: 463 Bytes
Versions: 19
Compression:
Stored size: 463 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.generate 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
19 entries across 19 versions & 1 rubygems