Sha256: ccf9231dc0cdf82fff9311cb84dcb029c72481aabdea530deb7edfc1951482d3
Contents?: true
Size: 394 Bytes
Versions: 1
Compression:
Stored size: 394 Bytes
Contents
# frozen_string_literal: true class UUID4 module Formatter class Compact REGEXP = /^[\da-f]{12}[1-8][\da-f]{3}[89ab][\da-f]{15}$/i.freeze FORMAT = '%032x' def encode(uuid) FORMAT % uuid.to_int end def decode(value) return unless value.respond_to?(:to_str) && (value = value.to_str) =~ REGEXP value.hex end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uuid4-1.4.0 | lib/uuid4/formatter/compact.rb |