Skip to content

Instantly share code, notes, and snippets.

@LBRapid
Created April 24, 2014 17:11
Show Gist options
  • Save LBRapid/11262122 to your computer and use it in GitHub Desktop.
Save LBRapid/11262122 to your computer and use it in GitHub Desktop.
if source.split("\n")[0] =~ /nomustache/ or source.empty?
context.eval(source)
context.eval('JSON.stringify(payload)')
else
context['source'] = source
output = context.eval('Mustache.render(source, payload)')
JSON.parse(output)
output
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment