Inversion::Template::

CommentTag class

Inversion ‘comment’ tag.

This tag hides its contents from the rendered output.

Syntax

<?comment ?><?end?>
<?comment Disabled for now ?>
   <?attr some_hidden_attribute ?>
<?end comment ?>

Public Instance Methods

as_comment_body()

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

# File lib/inversion/template/commenttag.rb, line 35
def as_comment_body
        firstnode, lastnode = self.subnodes.first, self.subnodes.last
        nodecount = self.subnodes.length

        linedesc = if firstnode.linenum == lastnode.linenum
                        "on line %d" % [ firstnode.linenum ]
                else
                        "from line %d to %d" % [ firstnode.linenum, lastnode.linenum ]
                end

        return "Commented out %d nodes %s%s" % [
                nodecount,
                linedesc,
                self.body.empty? ? '' : ': ' + self.body,
        ]

end
render( state )

Render (or don’t render, actually) the comment’s subnodes.

# File lib/inversion/template/commenttag.rb, line 28
def render( state )
        return ''
end