Code#to_s: don't loop thrice

One loop is enough to complete the task.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>