module Inversion::Template::ContainerTag
A mixin for a tag that allows it to contain other nodes.
Attributes
subnodes[R]
The nodes the tag contains
Public Class Methods
new( * ) { |self| ... }
click to toggle source
Setup subnodes for including classes. :notnew:
Calls superclass method
# File lib/inversion/template/containertag.rb, line 9 def initialize( * ) @subnodes = [] super yield( self ) if block_given? end
Public Instance Methods
<<( node )
click to toggle source
Append operator: add nodes to the correct part of the parse tree.
# File lib/inversion/template/containertag.rb, line 21 def <<( node ) @subnodes << node return self end
is_container?()
click to toggle source
Tell the parser to expect a matching <?end ?> tag.
# File lib/inversion/template/containertag.rb, line 28 def is_container? return true end
Also aliased as: container?
render( renderstate )
click to toggle source
Default render method for containertags; rendering each of its subnodes and don’t render anything for the container itself.
# File lib/inversion/template/containertag.rb, line 36 def render( renderstate ) self.render_subnodes( renderstate ) end
render_subnodes( renderstate )
click to toggle source
Append the container’s subnodes to the ‘renderstate`.
# File lib/inversion/template/containertag.rb, line 42 def render_subnodes( renderstate ) self.subnodes.each {|node| renderstate << node } end