Created
August 28, 2010 19:57
-
-
Save JoshCheek/555505 to your computer and use it in GitHub Desktop.
show erb example from docs with files
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
From: James Edward Gray II <james@grayproductions.net> | |
To: <%= to %> | |
Subject: Addressing Needs | |
<%= to[/\w+/] %>: | |
Just wanted to send a quick note assuring that your needs are being | |
addressed. | |
I want you to know that my team will keep working on the issues, | |
especially: | |
<%# ignore numerous minor requests -- focus on priorities %> | |
% priorities.each do |priority| | |
* <%= priority %> | |
% end | |
Thanks for your patience. | |
James Edward Gray II |
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
# based on the docs at http://ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html | |
require "erb" | |
# Create template. | |
template = File.read 'data.txt' | |
message = ERB.new template , 0 , "%<>" | |
# Set up template data. | |
to = "Community Spokesman <spokesman@ruby_community.org>" | |
priorities = [ "Run Ruby Quiz", | |
"Document Modules", | |
"Answer Questions on Ruby Talk" ] | |
# Produce result. | |
email = message.result | |
puts email |
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
From: James Edward Gray II <james@grayproductions.net> | |
To: Community Spokesman <spokesman@ruby_community.org> | |
Subject: Addressing Needs | |
Community: | |
Just wanted to send a quick note assuring that your needs are being | |
addressed. | |
I want you to know that my team will keep working on the issues, | |
especially: | |
* Run Ruby Quiz | |
* Document Modules | |
* Answer Questions on Ruby Talk | |
Thanks for your patience. | |
James Edward Gray II |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment