Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/userify/uid.rb
Constant Summary collapse
- BASE62_PRIMITIVES =
('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a
Instance Method Summary collapse
Instance Method Details
#base62 ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/userify/uid.rb', line 62 def base62 number = self result = '' while(number != 0) result = BASE62_PRIMITIVES[number % BASE62_PRIMITIVES.size ].to_s + result number /= BASE62_PRIMITIVES.size end result end |