Skip to content

Instantly share code, notes, and snippets.

@squarepegsys
Last active August 29, 2015 14:03
Show Gist options
  • Save squarepegsys/25e0fdb3d255b2601402 to your computer and use it in GitHub Desktop.
Save squarepegsys/25e0fdb3d255b2601402 to your computer and use it in GitHub Desktop.
import groovy.text.SimpleTemplateEngine
/* this causes
* groovy.lang.MissingPropertyException: No such property: firstName for class: bad_template
*/
def text = "${firstName} ${lastName} is a member of the ${lodge}"
def binding = [firstName: "Fred", lastName: "Flintstone", lodge:"Water Buffaloes"]
def engine = new SimpleTemplateEngine()
template = engine.createTemplate(text).make(binding)
assert template.toString()== "Fred Flintstone is a member of the Water Buffaloes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment