Skip to content

Instantly share code, notes, and snippets.

@zombor
Forked from defunkt/layout.rb
Created May 27, 2010 01:53
Show Gist options
  • Save zombor/415339 to your computer and use it in GitHub Desktop.
Save zombor/415339 to your computer and use it in GitHub Desktop.
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