From: Kev Jackson Date: 2006-03-29T17:47:27+09:00 Subject: Re: strings and ruby style? >>ie is it better to use args[1].to_s or "#{args[1]}" >> >> > >to_s, but if you control your $test_data and args, and can't imagine how >args[1] or args[2] could be anything other than strings, there's no need for >a cast at all. > > > My original goal was to allow the qc team to write text :id, :pg_401, :name So the arguments in theory should be symbols not strings, hence the need for some kind of to_s/#{} hackery >>My current thinking is that "#{}" should be used when concatenating >>strings together with values (or interpolating), where as .to_s should be >>used when you want the string representation of an object. >> >> > >I don't like using interpolation when the stuff I'm interpolating is bigger >than the literal part of the string. > > However, coming from a Java background, "s1" + "s2" is a performance (memory/speed) nightmare, so I shy away from S1 + S2 and try to use #{S1}S2 where possible. Perhaps string + string isn't so bad in Ruby, but old habits die hard... Thanks Kev