class String def substitute(binding=TOPLEVEL_BINDING) eval(%{"#{self}"}, binding) end end template = %q{static string #{food}!} food = 'b' template.substitute(binding) food = 'p' template.substitute(binding)