method

eval

v1_8_7_72 - Show latest stable - Class: Kernel
eval(...)
public

Evaluates the Ruby expression(s) in string. If binding is given, the evaluation is performed in its context. The binding may be a Binding object or a Proc object. If the optional filename and lineno parameters are present, they will be used when reporting syntax errors.

   def getBinding(str)
     return binding
   end
   str = "hello"
   eval "str + ' Fred'"                      #=> "hello Fred"
   eval "str + ' Fred'", getBinding("bye")   #=> "bye Fred"