From: Sy Ali Date: 2006-09-10T22:50:34+09:00 Subject: patching strings together to make a variable I'm curious to know if I can patch multiple things together to make a variable. I have some imaginary code snippets. The most direct way I can think of is something like this: $a = true $var = "fail" $variable = "pass" puts "#{$var(if $a == true then "iable" end)}" since $a == true, I would like this to become: puts "#{$variable}" But this doesn't work. I didn't expect it to, but is something like this possible? Am I stuck with this? : puts "#{if $a == true then $variable else $var end}" What I'd really like to learn is how I can patch multiple strings together and call it a variable. I think I'm just missing some simple piece of this puzzle.. The imaginary code would be: ab = "pass" puts ("a" + "b").to_variable Or to a global, an instance variable, etc.. envisioned like this: puts $("a" + "b") puts @("a" + "b") If there's a simple way to do this, a code snippet or a pointer to a manual reference would be all I need.