Last active
August 29, 2015 13:56
-
-
Save fidelisrafael/8894884 to your computer and use it in GitHub Desktop.
Mustache and inline template test
This file contains 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
require 'mustache' | |
class MustacheTest | |
def self.init | |
template = DATA.read | |
puts Mustache.render(template, name: "User Name", email: 'user@email.com', subject: 'Contact', area: 'Marketing', question_type: '1', message: 'Hi there, i need some support (...)', date: Time.now.strftime("%d/%m/%Y %T"), ip: '127.0.0.1', origin: File.expand_path(__FILE__) ) | |
end | |
end | |
at_exit { MustacheTest.init } | |
__END__ | |
<div class='mail-body' style='margin:0;padding:0;'> | |
<div class="wrapper body"> | |
<table class="fields" cellpadding="10" cellspacing="5"> | |
<tr> | |
<td><strong>Name:</strong></td> | |
<td><em>{{name}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>Email:</strong></td> | |
<td><em>{{email}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>Subject:</strong></td> | |
<td><em>{{subject}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>Area:</strong></td> | |
<td><em>{{area}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>Question Type:</strong></td> | |
<td><em>{{question_type}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>Message:</strong></td> | |
<td><em>{{message}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>Date:</strong></td> | |
<td><em>{{date}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>IP:</strong></td> | |
<td><em>{{ip}}</em></td> | |
</tr> | |
<tr> | |
<td><strong>Origin:</strong></td> | |
<td><em>{{origin}}</em></td> | |
</tr> | |
</table> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run: