class UUID4::Formatter::Default

Constants

FORMAT
REGEXP

Public Instance Methods

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