class UUID4::Formatter::URN

Constants

FORMAT
REGEXP

Public Instance Methods

decode(value) click to toggle source
# File lib/uuid4/formatter/urn.rb, line 11
def decode(value)
  if value.respond_to?(:to_str) && (value = value.to_str) =~ REGEXP
    value[9..-1].tr('-', '').hex
  end
end
encode(uuid) click to toggle source
# File lib/uuid4/formatter/urn.rb, line 7
def encode(uuid)
  FORMAT % uuid.components
end