Displaying 1 result from an estimated 1 matches for "e1c761b71b63b82e".
2008 May 22
1
Why can't I define vars in caller's binding using eval?
In other words, why can''t I do this?
def f(b)
eval("x = 10", b)
end
f(binding)
puts "x = #{x}"
Is there any way to make that code work (besides obviously setting x
to something before calling f).
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"