I'm writing a short tutorial introduction to Ruby for an upcoming uni
computing society magazine.

I wanted a simple example of redefining a method of an existing class and
wrote my own Array#to_s that returns things like "[1, 2, 3, 4, 5]" (ie,
sticks brackets around the entries, and separates them with commas).

This works fine when I do

    a = [1, 2, 4, 4, 5]

    puts "#{a}"

but when I do

    puts a

it outputs a in the standard form.

This got me to thinking how puts does its conversion to a string.  I ask
because (a) I'm surprised it doesn't just use to_s and because someone
reading the article is bound to ask :-).

By the way, I plan to ask for comments on the article when I have an
initial version.