craig duncan <duncan / nycap.rr.com> writes:

> So, regarding my question about how string interpolation is done,
> apparently it's not equivalent to `to_s' for a string.  Class String
> seems to be special in certain ways.

Yes, in this case the interpreter cheats. When it converts the value
of the expression in #{} back to a string, it first checks to see if
it is already a string, in which case it copies it directly in. It
then tries to call its to_s method. If that fails, it falls back on
the #<Foo:...> notation.

So, I'm happy to say that it is _equivalent_ to to_s for a String. It
just doesn't call it ;-)


Dave