Created
September 19, 2011 15:38
-
-
Save DNNX/1226780 to your computer and use it in GitHub Desktop.
ERB+Windows bug (extra newlines)
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 'erb' | |
arr = [1,2,3] | |
context = instance_eval('binding') | |
src = ::File.binread('template.rb.tt') | |
content = ERB.new(src, nil, '-', '@output_buffer').result(context) | |
print content |
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
* 1 | |
* 2 | |
* 3 |
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
<%- arr.each_with_index do |c,i| -%> | |
<%= ' '*i %>* <%= c %> | |
<%- end -%> |
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
* 1 | |
* 2 | |
* 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment