Created
November 13, 2014 13:47
-
-
Save mikecmpbll/72a32f79dc3821e9d2a8 to your computer and use it in GitHub Desktop.
Explanation of trim level differences between Erubis and the ERB when Rails used both.
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
irb(main):045:0> ERB.new("<% if true -%>\nhi\n<% else %>\nbye\n<% end %>", nil, "-").result # old rails with '-' | |
=> "hi\n" | |
irb(main):047:0> ERB.new("<% if true %>\nhi\n<% else %>\nbye\n<% end %>", nil, "-").result # old rails without '-' | |
=> "\nhi\n" | |
irb(main):048:0> Erubis::Eruby.new("<% if true %>\nhi\n<% else %>\nbye\n<% end %>").result # new rails with Erubis default trim | |
=> "hi\n" | |
irb(main):049:0> Erubis::Eruby.new("<% if true %>\nhi\n<% else %>\nbye\n<% end %>", trim: false).result # Erubis with trimming turned off | |
=> "\nhi\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment