Ruby's Fixnum#to_s( base )
and String#to_i( base )
are for representing numbers in different bases. You cannot use arbitrary characters with them though, they are designed to be compatible with conventions for hex and base64 amongst other things.
If you were not converting to a different base, but simply encoding decimal digits as letters and back, then a simple substitution would be all you needed:
46.to_s.tr( "0123456789", "abcdefghijk" )
=> "eg"
"eg".tr( "abcdefghijk", "0123456789" ).to_i
=> 46
So, if you want to do both, and use a-z to represent your number in base 26:
46.to_s(26).tr( "0123456789abcdefghijklmnopq", "abcdefghijklmnopqrstuvwxyz" )
=> "bu"
"bu".tr( "abcdefghijklmnopqrstuvwxyz", "0123456789abcdefghijklmnopq" ).to_i(26)
=> 46