Groovy Writable Object?

242 Views Asked by At

Have a SimpleTemplate class that returns a Writable object. Can this be done as i can't see what kind of object to return. I have tried someting like this:

  Writable getTemplate()  { return 'something that's a writable' }  

and how would i read variable from another method ?

1

There are 1 best solutions below

0
On

You could do this to return some writable string content:

Writable getTemplate() {
    { it.println "Some content" }.asWritable()
}