Included Modules

Inversion::Template::EndTag

Closing tag class

Attributes

opener[R]

The ContainerTag that this end tag closes

Public Class Methods

new( body='', linenum=nil, colnum=nil ) click to toggle source

Overridden to provide a default body.

# File lib/inversion/template/endtag.rb, line 14
def initialize( body='', linenum=nil, colnum=nil )
        super
        @opener = nil
end

Public Instance Methods

as_comment_body() click to toggle source

Render the tag as the body of a comment, suitable for template debugging.

# File lib/inversion/template/endtag.rb, line 50
def as_comment_body
        return "End of %s" % [ self.opener.as_comment_body ]
end
before_appending( state ) click to toggle source

Parser callback -- close the given state's currently-open container node.

# File lib/inversion/template/endtag.rb, line 29
def before_appending( state )
        @opener = state.pop
        self.log.debug "End tag for %s at %s" % [ @opener.tagname, @opener.location ]

        # If the end tag has a body, it should match the container that's just
        # been popped.
        if self.body &&
                !self.body.empty? &&
                self.body.downcase != @opener.tagname.downcase

                raise Inversion::ParseError, "unbalanced end: expected %p, got %p" % [
                        @opener.tagname.downcase,
                        self.body.downcase,
                ]
        end

        super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.