>> string = \'#{var}\' => \"\\#{var}\" >> proc = Proc.new { |var| string } => # >> proc.call(123) => \"\\
It works with eval:
proc = Proc.new { |var| eval(%Q{"#{string}"}) }
(If you trust the value of string.)