Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Stringを拡張してバインド変数のマップを渡してパースできるようにする
String.metaClass.parse = { Map binding = [:] ->
new groovy.text.SimpleTemplateEngine()
.createTemplate(new StringReader(delegate))
// エルシャダイ風にテスト
def result = '''
<%= user2 %>「<%= serif2 %>」
user1: 'ルシフェル', serif1: 'そんな装備で大丈夫か?',
user2: 'イーノック', serif2: '大丈夫だ、問題ない'
assert '''
''' == result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.