-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong context in different types of eval calls #3072
Comments
Thanks @matz! I'm still having trouble with the string interpolation when instance_eval'ing a string directly though.
|
Oops! Sorry... Didn't think about the string interpolation happening before the eval. That was just a bad test. Thanks very much! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably easiest to demonstrate with code. I've duplicated some code, and run it in different types of eval calls. It's interesting how the type of eval and the use of string interpolation affect the value of
self
. In every case, it should be an instance ofMyClass
, but often it becomesmain
.Results:
Code:
I'm trying to get to the bottom of this issue, which seems to be caused by a similar mixup with the value of local variables. In that case it happens when eval-ing a string - but only if you do it in a method. I'm hoping they're related!
The text was updated successfully, but these errors were encountered: