class Inversion::Template::TextNode
Inversion
text node class – container for static content in templates between tags.
Attributes
body[R]
The node body
Public Class Methods
new( body, linenum=nil, colnum=nil )
click to toggle source
Create a new TextNode
with the specified ‘source`.
Calls superclass method
Inversion::Template::Node::new
# File lib/inversion/template/textnode.rb, line 10 def initialize( body, linenum=nil, colnum=nil ) @body = body super end
Public Instance Methods
as_comment_body()
click to toggle source
Render the text node as the body of a comment.
# File lib/inversion/template/textnode.rb, line 34 def as_comment_body comment_body = self.body[0,40].dump comment_body[-1,0] = '...' unless comment_body == self.body.dump return "Text (%d bytes): %s" % [ self.body.length, comment_body ] end
render( renderstate )
click to toggle source
Render the node.
# File lib/inversion/template/textnode.rb, line 25 def render( renderstate ) body = self.body.dup body.sub!( /\A\r?\n/, '' ) if renderstate && renderstate.options[:strip_tag_lines] return body end