Eval / current binding

Hey,

So I’ve looked at module_eval, class_eval, and Kernel#eval

and I’m pretty sure that what I want to do is to do Kernel#eval(“blah

some code”, global_environment)

where by global_environment I mean the global_context or the
global_binding

The problem now … is that I don’t know how to access this global
environment / global context / global binding … is there a function
that I
can call that will

(1) get me the global binding / global env / global context or
(2) a function that I can call that will get me the current binding /
env
/ context

Thanks,
(when replying please cc the list and me)

On Nov 30, 3:42 pm, redroofgreentree [email protected]
wrote:

global_binding
(when replying please cc the list and me)
The TOPLEVEL_BINDING constant…but the standard disclaimer is don’t
use eval (depends on what you’re doing though). It is generally not
safe unless you have 100% control over the input, because it can do
everything ruby can (i.e., eval doesn’t run in any kind of sandbox),
so in an untrusted context, it’s dangerous.

Regards,
Jordan