I know that if I have a proc created in one scope and I want to execute it in another, I have to use instance_eval
to do it. But what if I want to leave the proc in the scope it was in, but I just want to give it access to variables from another scope?
The original scope of the proc is in main
and I cannot just directly add variables to main. I have to add variables specifically to the proc.
After looking at the docs for binding, I noticed that it is not possible to do what I am trying to do with bindings without eval (and eval is both slow and evil) so I am looking for a better way to do this.