Method: Capcode::Helpers#content_for
- Defined in:
- lib/capcode/helpers.rb
#content_for(x) ⇒ Object
Calling content_for stores a block of markup in an identifier.
module Capcode
class ContentFor < Route '/'
def get
render( :markaby => :page, :layout => :layout )
end
end
end
module Capcode::Views
def layout
html do
head do
yield :header
end
body do
yield :content
end
end
end
def page
content_for :header do
title "This is the title!"
end
content_for :content do
p "this is the content!"
end
end
end
222 223 224 225 226 |
# File 'lib/capcode/helpers.rb', line 222 def content_for( x ) if Capcode::Helpers.args.map{|_| _.to_s }.include?(x.to_s) yield end end |