ここで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」を取得する方法は??