From: Peter Fitzgibbons Date: 2005-10-19T01:32:26+09:00 Subject: Re: Expression Interpolation from input "template string"? On 10/18/05, Warren Brown wrote: > Peter, > > > What I don't know is how to get the interpolation to > > work when the string is read from teh database as if : > > > > x = 'Hello, today is #{msgDate}' > > The easiest way to do this is to #eval() the string with quotes > around it: > > irb(main):001:0* s = 'This is #{a} test.' > => "This is \#{a} test." > irb(main):002:0> a = 'one' > => "one" > irb(main):003:0> eval("\"#{s}\"") > => "This is one test." > > If you're like me, you'll want to use a quoting method prettier than > \" inside the string: > > irb(main):004:0> eval("%{#{s}}") > => "This is one test." > > I hope this helps. > > - Warren Brown > > > That's stinkin amazing! How/Where did you reference the knowledge for using %{} and how to embed interpolation (Is this nested interpolation?) Thanks for the info! Peter Fitzgibbons