From: Xavier Noria Date: 2007-08-26T18:48:00+09:00 Subject: Re: String interpolation On Aug 26, 2007, at 11:20 AM, Thomas Worm wrote: > a = 5 > b = "#{a}" > puts b > > a = 6 > puts b > > Returns: > 5 > 5 > > which is clear to me, why. But is there a way to define such a > string and > interpolate it at a later time? You normally use a templating system, for example: require 'erb' b = ERB.new("a is <%= a %>") a = 5 puts b.result(binding) # -> a is 5 a = 6 puts b.result(binding) # -> a is 6 -- fxn