-
-
Save zombor/415339 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 'mustache' | |
class Layout < Mustache | |
self.template = "Header | |
{{{yield}}} | |
Footer" | |
end | |
class Index < Mustache | |
self.template = "The Index." | |
end | |
class Profile < Mustache | |
self.template = "The Profile." | |
end | |
def render(klass) | |
view = Layout.new | |
view[:yield] = klass.render | |
view.render | |
end | |
puts "Index:" | |
puts render(Index) | |
puts | |
puts "Profile:" | |
puts render(Profile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment