Skip to content

Instantly share code, notes, and snippets.

@felipeelias
Created June 15, 2017 19:43
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 felipeelias/50a647e6c96a42d8a30f5916d1463ae6 to your computer and use it in GitHub Desktop.
Save felipeelias/50a647e6c96a42d8a30f5916d1463ae6 to your computer and use it in GitHub Desktop.
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
<% wrap(:div) do %>
Hello!
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment