When I run groovysh I'd like to add some classes so they execute as though they were delegates. It should work like this:
assuming these classes exist:
def A{
def test() {println "test"}
}
def B{
def test2() {println "test2"}
}
I'd like to be able to do this:
groovysh
groovy:000>test()
test
groovy:000>test2()
test2
I might be able to scan the classes and manually add each method to the groovy.properties file but that would be extremely fragile.
Is there some way to either specify those classes as delegates or somehow make it act as though I had done something equivalent to:
new A().using{new B.using{ <groovysh runs in here> }}