class UUID4::Formatter::Base62

Constants

REGEXP

Public Instance Methods

decode(value) click to toggle source
# File lib/uuid4/formatter/base62.rb, line 12
def decode(value)
  if value.respond_to?(:to_str) && (value = value.to_str) =~ REGEXP
    if ::UUID4.valid_int?(int = ::Base62.decode(value))
      int
    end
  end
end
encode(uuid) click to toggle source
# File lib/uuid4/formatter/base62.rb, line 8
def encode(uuid)
  ::Base62.encode(uuid.to_i)
end