Class: Fixnum
Instance Method Summary collapse
-
#to_b(base = 62) ⇒ Object
this is used to convert a number into segments of base 62 (or 36) for use in creating email IDs.
Instance Method Details
#to_b(base = 62) ⇒ Object
this is used to convert a number into segments of base 62 (or 36) for use in creating email IDs
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubymta/base-x.rb', line 28 def to_b(base=62) n = self r = "" while n > 0 m = n%base n /= base case when m>=36 k = m+61 when m>=10 k = m+55 when m>=0 k = m+48 end r << k.chr end return r.reverse end |