Last active
August 29, 2015 14:03
-
-
Save squarepegsys/25e0fdb3d255b2601402 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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