if i change the code in Groovy DSL Doc here.
add some string 'hello world' to email, like this
email('hello world') { // change here
from '[email protected]'
to '[email protected]'
subject 'The pope has resigned!'
body {
p 'Really, the pope has resigned!'
}
}
and change
def email(def name, @DelegatesTo(EmailSpec) Closure cl) { // change here
def email = new EmailSpec()
def code = cl.rehydrate(email, this, this)
code.resolveStrategy = Closure.DELEGATE_ONLY
code.call(name) // change here
}
so, how to modify the class EmailSpec to get the string 'hello world' ??
Yes, i found a way, but not perfect.
Simple
however, i really want to use groovy function call(name) to solve it