From: Taisuke Yamada Date: 2005-04-22T15:34:37+09:00 Subject: Clean way to dynamically expand string with "#{expression}"? Hi. I'm trying to find a clean way to expand string with "#{...}". What I want to do is essentially as follows: data = 123 expr = 'data = #{data}' puts dosomething(expr) and get 'data = 123' as a result. Actual content of 'expr' can be anything, as long as it is a String object. I came up with following: puts eval(%Q{"#{expr.gsub('"', '\"')}"}) But this is ugly, and I'm wondering if there's some other, cleaner way to do the same thing. Can anyone enlighten me? Best Regards, -- Taisuke Yamada