Fixnum#to_s takes an optional base argument and represents the given number in that base:

2.to_s(2)   # => "10"
3.to_s(2)   # => "11"
3.to_s(3)   # => "10"
10.to_s(16) # => "a"

If no argument is provided, then it represents the number in base 10

2.to_s # => "2"
10423.to_s # => "10423"