From: "Hal E. Fulton" Date: 2002-09-21T06:06:52+09:00 Subject: Re: String interpolation at will? ----- Original Message ----- From: "Hal E. Fulton" To: "ruby-talk ML" Sent: Friday, September 20, 2002 3:30 PM Subject: Re: String interpolation at will? > Hmm, there have been times I wished for a String.interpolate > method... couldn't be too hard to expose it. Wonder if it's > worth it? To reply to myself: I've just remembered why this is nontrivial in pure Ruby. If you write a String#interpolate, it can't get to your local variables, i.e. if you do: bar = "secret" foo = 'code is #{bar}' str = foo.interpolate it won't work because #interpolate can't see the bar variable. Hmm. You can still do it outside of a method, of course. I'm playing with a Proc now out of curiosity. Hal