On Thu, Feb 19, 2009 at 7:39 PM, Andrew Timberlake
<andrew / andrewtimberlake.com> wrote:
> On Thu, Feb 19, 2009 at 3:41 PM, Ashikali Ashikali <ashikali.m / gmail.com>wrote:
>
>> Analyse this code
>>
>> a = 10
>> b = "This is #{a}" # prints "This is 10"
>> b = 'This is #{c}' # prints "This is \#{c}"
>> c = 18
>>
>> b # "This is \#{c}"
>>
>> Here I want ,
>> "This is 18"
>>
>> Question ,
>> How can I convert '' value to "" value .
>> --
>>
>
> Your question is not clear

If i might venture a guess, i think Ashikali wants the interpolation
to occur lazily.
I don't know a way to construct a string that defers interpolation
(though i suspect there must be one).

If not, you could use 'eval' or perhaps a Proc:

$: irb
01> s = lambda {|x| "This is #{x}" }
--> #<Proc:0x735a64@(irb):1 (lambda)>
02> s.call 1
--> "This is 1"
03> s.call 2
--> "This is 2"

HTH.
lasitha.