From: LAMBEAU Bernard Date: 2010-12-07T21:39:52+09:00 Subject: Re: How to delay "string" interpretation? --00163630ff89f151600496d14c88 Content-Type: text/plain; charset=ISO-8859-1 To my knowledge, you won't be able to do it in a straightforward way. Maybe consolidating the following code would do the job... class ActiveString def initialize(pattern, binding) @pattern = pattern @binding = binding end def to_s Kernel.eval '"' + @pattern + '"', @binding end end a, b = "a", "b" str = ActiveString.new('#{a} + #{b}', Kernel.binding) puts str.to_s a, b = "a2", "b2" puts str.to_s Hope it helps, B On Tue, Dec 7, 2010 at 1:11 PM, Fritz Trapper wrote: > Suppose the following code: > > t='#{a} + #{b}' > ... > a='a';b='b' > > How to cause ruby to interpret t as a "string" to get the result string > "a + b"? > > -- > Posted via http://www.ruby-forum.com/. > > --00163630ff89f151600496d14c88--