From: James Edward Gray II Date: 2006-01-18T22:43:09+09:00 Subject: Re: Delayed quote expansion On Jan 18, 2006, at 6:48 AM, Kevin Olbrich wrote: > Lots of good responses here, but the one that turns out to be the > easiest is... > > def func(param) > some_value = 42 > value = eval %Q{%Q{#{param}}} > end > > func('my number is #{some_value}') #=> 'my number is 42' What you really want here is ERB: >> require "erb" => true >> def expand( template ) >> some_value = 42 >> ERB.new(template).result(binding) >> end => nil >> expand "My number is <%= some_value %>." => "My number is 42." James Edward Gray II