On Tue, 22 Oct 2002 13:49:47 +0900, andrew delboy wrote:
> On Tue, Oct 22, 2002 at 01:23:37PM +0900, Hal E. Fulton wrote:
>> What you want is something like one of these:
>> 
>> geom = "+#{x}+#{y}"
>> geom = "+" + x.to_s + "+" + y.to_s
> Is there a way to concatonate strings without having to use the
> x.to_s method?
> 
> In other words, because "+" is a string to start the expression,
> wouldnt the plus operator actually be the '+' method within the
> string object? And thus wouldnt the string want to use 'string
> values' of the objects they are concatonating?

Look at Hal's first suggestion. That basically does exactly what
you're after (e.g., "+#{x}+#{y}" is the very same thing as the
second version and does exactly what you want). Doing #{} within a
string does an implicit #to_s call.

-austin
-- Austin Ziegler, austin / halostatue.ca on 2002.10.22 at 02.00.47