Skip to content

Instantly share code, notes, and snippets.

@DNNX
Created September 19, 2011 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DNNX/1226780 to your computer and use it in GitHub Desktop.
Save DNNX/1226780 to your computer and use it in GitHub Desktop.
ERB+Windows bug (extra newlines)
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
<%- arr.each_with_index do |c,i| -%>
<%= ' '*i %>* <%= c %>
<%- end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment