Mega Code Archive

 
Categories / Ruby / String
 

Add method to system type

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)