Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/rand62/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#base62Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/rand62/core_ext.rb', line 19

def base62
  return '0' if (i = self) == 0
  s = ''
  while i > 0
    s << Rand62::CHARS[i.modulo(62)]
    i /= 62
  end
  s.reverse!
  s
end