def testClosure(body) { def config = [:] body.resolveStrategy = Closure.DELEGATE_FIRST body.delegate = config body() if (config["testHook"]) { config["testHook"].call() } } testClosure() { testHook = { println "testHook" } testHook2 = { println "testHook2" } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more