eval(string [, binding [, filename [,lineno]]]) รข obj
Instance Public methods
Evaluates the Ruby expression(s) in string. If binding is
given, which must be a Binding
object, the evaluation is
performed in its context. If the optional filename and
lineno parameters are present, they will be used when reporting
syntax errors.
def get_binding(str) return binding end str = "hello" eval "str + ' Fred'" #=> "hello Fred" eval "str + ' Fred'", get_binding("bye") #=> "bye Fred"
Please login to continue.