On Feb 8, 2012, at 08:36 , Bravo Man wrote:

> Hi,
> 
> I come from the world of other programming languages and in the process
> of learning Ruby I am trying to implement a few algorithms.
> 
> It would be great if you could assist me with proposal for implementing
> it in a more "ruby" way tham directly following the pattern from "java"
> for example.
> 
> I would like to convert integers to strings where the strings are of the
> form XXX. X is a digit from 0 to 9 or a letter from A to Z. So 11 gets
> converted to 00B. 37 is 010. And 46656 gets converted to ZZZ.

I know you're trying to do some exercises to learn ruby so this suggestion is probably not entirely apropros, but I think your math might be bad (OR: I'm uncaffienated, OR: I missed something obvious). 

>> 11.to_s 36
=> "b"
>> 37.to_s 36
=> "11"
>> 46656.to_s 36
=> "1000"
>> 46655.to_s 36
=> "zzz"

the rest of the formatting can easily be done using String methods:

>> 37.to_s(36).rjust(3,'0')
=> "011"

And I agree with Steve... the name is terrible. In this case I'd probably put a method on Fixnum and name it to_key or somesuch.

37.to_key # => "011"