D
Damjan Rems
Just an idea which may come in handy. Can this be done and how in Ruby.
def calc(what)
some_eval(what)
end
a=10
b=12
calc('a+b') # expression as parameters
=> 12 # would return
a='aa'
b='bb'
calc('a+b')
=> 'aabb'
This is of course strictly hypothetical. I would like the expression to
be evaluated inside the method using variables which are local to the
calling part.
by
TheR
def calc(what)
some_eval(what)
end
a=10
b=12
calc('a+b') # expression as parameters
=> 12 # would return
a='aa'
b='bb'
calc('a+b')
=> 'aabb'
This is of course strictly hypothetical. I would like the expression to
be evaluated inside the method using variables which are local to the
calling part.
by
TheR