如果我在这里更改Groovy DSL Doc中的代码。
在电子邮件中添加一些字符串“hello world”,就像这样
email('hello world') { // change here
from 'dsl-guru@mycompany.com'
to 'john.doe@waitaminute.com'
subject 'The pope has resigned!'
body {
p 'Really, the pope has resigned!'
}
}
和改变
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
}
那么,如何修改类 EmailSpec 以获取字符串 'hello world' ?