Method: Innate::Node#layout
- Defined in:
- lib/innate/node.rb
#layout(layout_name = nil, &block) ⇒ Proc, String
Define a layout to use on this Node.
A Node can only have one layout, although the template being chosen can depend on #provides.
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 |
# File 'lib/innate/node.rb', line 682 def layout(layout_name = nil, &block) if layout_name and block # default name, but still check with block trait(:layout => lambda{|name, wish| layout_name.to_s if block.call(name, wish) }) elsif layout_name # name of a method or template trait(:layout => layout_name.to_s) elsif block # call block every request with name and wish, returned value is name # of layout template or method trait(:layout => block) else # remove layout for this node trait(:layout => nil) end return ancestral_trait[:layout] end |