Created
June 15, 2017 19:43
-
-
Save felipeelias/50a647e6c96a42d8a30f5916d1463ae6 to your computer and use it in GitHub Desktop.
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 "ecr" | |
class Greeting | |
# def wrap(tag) | |
# String.build do |str| | |
# str << "<#{tag}>" | |
# str << yield | |
# str << "</#{tag}>" | |
# end | |
# end | |
def wrap(tag) | |
str = yield | |
str << "</#{tag}>" | |
end | |
ECR.def_to_s "greeting.ecr" | |
end | |
puts Greeting.new.to_s |
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
<% wrap(:div) do %> | |
Hello! | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment