H
Hans Sjunnesson
Hey all,
I'm implementing a simple queue system with which I'm evaling 'jobs',
like so:
code = lambda {eval(job)}
code.call
Where 'job' is a string containing ruby code.
The problem I'm having is that I need these jobs to evaluate in a
clean environment, uncluttered by the previous jobs. What I'd like is
something along the lines of this:
temp = Kernel.binding
code = lambda {eval(job)}
code.call
Kernel.binding = temp
Though that looks sort of dangerous.
Another idea might be to be able to create a binding which is a deep
copy of the current binding. I'm not sure if this has been done before.
I'm implementing a simple queue system with which I'm evaling 'jobs',
like so:
code = lambda {eval(job)}
code.call
Where 'job' is a string containing ruby code.
The problem I'm having is that I need these jobs to evaluate in a
clean environment, uncluttered by the previous jobs. What I'd like is
something along the lines of this:
temp = Kernel.binding
code = lambda {eval(job)}
code.call
Kernel.binding = temp
Though that looks sort of dangerous.
Another idea might be to be able to create a binding which is a deep
copy of the current binding. I'm not sure if this has been done before.