Right now, when I'm trying to eval a piece of code in Groovy, I have to do something like this :
new GroovyShell(new Binding([var1:var1])).evaluate(line)
This can be pretty nasty when you have a lot of variables defined. Is there a better way of doing this? Is there something like Python's locals
, or something similar that lists all the declared variables?