Parent

Included Modules

Inversion::Template::Node

Inversion template node base class. Template text is parsed by the Inversion::Parser into nodes, and appended to a tree that is later walked when the template is rendered.

This class is abstract; it just defines the API that other nodes are expected to implement.

Attributes

colnum[R]

The column number the node was parsed from in the template source (if known)

linenum[R]

The line number the node was parsed from in the template source (if known)

Public Class Methods

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

Create a new TextNode with the specified source.

# File lib/inversion/template/node.rb, line 18
def initialize( body, linenum=nil, colnum=nil )
        @body    = body
        @linenum = linenum
        @colnum  = colnum
end

Public Instance Methods

after_append( state ) click to toggle source
Alias for: after_appending
after_appending( state ) click to toggle source

Default (no-op) implementation of the after_appending callback. This exists so defining the append callbacks are optional for Node's subclasses.

# File lib/inversion/template/node.rb, line 77
def after_appending( state )
        # Nothing to do
        return nil
end
Also aliased as: after_append
after_render( state=nil ) click to toggle source
Alias for: after_rendering
after_rendering( state=nil ) click to toggle source

Default (no-op) implementation of the after_rendering callback. This exists so defining the rendering callbacks are optional for Node's subclasses.

# File lib/inversion/template/node.rb, line 95
def after_rendering( state=nil )
        # Nothing to do
        return nil
end
Also aliased as: after_render
as_comment_body() click to toggle source

Render the node as a comment

# File lib/inversion/template/node.rb, line 44
def as_comment_body
        return self.inspect
end
before_append( state ) click to toggle source
Alias for: before_appending
before_appending( state ) click to toggle source

Default (no-op) implementation of the before_appending callback. This exists so defining the append callbacks are optional for Node's subclasses.

# File lib/inversion/template/node.rb, line 68
def before_appending( state )
        # Nothing to do
        return nil
end
Also aliased as: before_append
before_render( state=nil ) click to toggle source
Alias for: before_rendering
before_rendering( state=nil ) click to toggle source

Default (no-op) implementation of the before_rendering callback. This exists so defining the rendering callbacks are optional for Node's subclasses.

# File lib/inversion/template/node.rb, line 86
def before_rendering( state=nil )
        # Nothing to do
        return nil
end
Also aliased as: before_render
container?() click to toggle source
Alias for: is_container?
is_container?() click to toggle source

Returns true if the node introduces a new parsing/rendering scope.

# File lib/inversion/template/node.rb, line 50
def is_container?
        return false
end
Also aliased as: container?
location() click to toggle source

Return the location of the tag in the template, if it was parsed from one (i.e., if it was created with a StringScanner)

# File lib/inversion/template/node.rb, line 58
def location
        return "line %s, column %s" % [
                self.linenum || '??',
                self.colnum  || '??',
        ]
end
render( render_state ) click to toggle source

Render the node using the given render_state. By default, rendering a node returns nil.

# File lib/inversion/template/node.rb, line 38
def render( render_state )
        return nil
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.