Inversion::

TemplateTiltAdditions module

Also add each to Inversion::Template so they can be returned from actions directly, too.

Public Instance Methods

each() { |node| ... }

TODO: Factor the common parts of this out in Inversion::Template so there’s no duplication.

# File lib/inversion/tilt.rb, line 52
def each
        self.log.info "rendering template 0x%08x (Sinatra-style)" % [ self.object_id/2 ]
        state = Inversion::RenderState.new( nil, self.attributes, self.options )

        # Pre-render hook
        self.walk_tree {|node| node.before_rendering(state) }

        self.log.debug "  rendering node tree: %p" % [ @node_tree ]
        self.walk_tree {|node| state << node }

        # Post-render hook
        self.walk_tree {|node| node.after_rendering(state) }

        self.log.info "  done rendering template 0x%08x" % [ self.object_id/2 ]
        return state.destination.each do |node|
                yield( node.to_s )
        end
end