Subversion Info

Rev
437
Last Checked In
2008-03-28 00:49:20 (2 weeks ago)
Checked in by
deveiant

Class Index

Quicksearch

Arrow::Template::TextNode

The plain-content node object class. Instances of this class are nodes in a syntax tree which represents the textual contents of an Arrow::Template object.

Constants

SVNRev
SVN Revision
SVNId
SVN Id

Attributes

body[RW]
The node body

Public Class Methods

new( body, type="text" ) click to toggle source

Create a new Arrow::Template::TextNode object with the given body.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 186
186:         def initialize( body, type="text" )
187:             @body = body
188:             super( type )
189:         end

Public Instance Methods

=~( obj ) click to toggle source

Match operator — if obj is a Regexp, use it as a pattern to match against the node‘s body. If obj is a String, look for it in the node‘s body, similar to String#index. Returns the position the match starts, or nil if there is no match. Otherwise, invokes obj#=~, passing the node‘s body as an argument.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 204
204:         def =~( obj )
205:             case obj
206:             when Regexp
207:                 obj.match( self.body )
208:             when String
209:                 self.body.index( obj )
210:             else
211:                 obj.=~( self.body )
212:             end
213:         end
inspect() click to toggle source

Return a human-readable version of the object suitable for debugging messages.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 239
239:         def inspect
240:             %Q{<%s Node: %s>} % [ @type.capitalize, @body.inspect ]
241:         end
is_rendering_node?() click to toggle source

Returns true for nodes which generate output themselves (as opposed to ones which generate output through subnodes). This is used for eliding blank lines from the node tree.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 219
219:         def is_rendering_node?
220:             true
221:         end
to_html() click to toggle source

Return an HTML fragment that can be used to represent the node symbolically in a web-based introspection interface.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 232
232:         def to_html
233:             super { self.escape_html(@body) }
234:         end
to_s() click to toggle source

Return the node as a String.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 225
225:         def to_s
226:             self.body.to_s
227:         end

secsequence

--- SEC00153

seccomment

--- ""

attributes

--- 
- name: body
  rw: RW
  a_desc: |+
    
    The node body
    

method_list

--- 
- methods: 
  - visibility: public
    aref: M000521
    name: new
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 186</span>\n\
      186:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">body</span>, <span class=\"ruby-identifier\">type</span>=<span class=\"ruby-value str\">&quot;text&quot;</span> )\n\
      187:             <span class=\"ruby-ivar\">@body</span> = <span class=\"ruby-identifier\">body</span>\n\
      188:             <span class=\"ruby-keyword kw\">super</span>( <span class=\"ruby-identifier\">type</span> )\n\
      189:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Create a <a href="TextNode.html#M000521">new</a> Arrow::Template::TextNode
      object with the given <tt>body</tt>.
      </p>
    params: ( body, type=&quot;text&quot; )
  category: Class
  type: Public
- methods: 
  - visibility: public
    aref: M000522
    name: =~
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 204</span>\n\
      204:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-operator\">=~</span>( <span class=\"ruby-identifier\">obj</span> )\n\
      205:             <span class=\"ruby-keyword kw\">case</span> <span class=\"ruby-identifier\">obj</span>\n\
      206:             <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-constant\">Regexp</span>\n\
      207:                 <span class=\"ruby-identifier\">obj</span>.<span class=\"ruby-identifier\">match</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">body</span> )\n\
      208:             <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-constant\">String</span>\n\
      209:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">body</span>.<span class=\"ruby-identifier\">index</span>( <span class=\"ruby-identifier\">obj</span> )\n\
      210:             <span class=\"ruby-keyword kw\">else</span>\n\
      211:                 <span class=\"ruby-identifier\">obj</span>.<span class=\"ruby-operator\">=~</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">body</span> )\n\
      212:             <span class=\"ruby-keyword kw\">end</span>\n\
      213:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Match operator &#8212; if <tt>obj</tt> is a Regexp, use it as a pattern to
      match against the node&#8216;s body. If <tt>obj</tt> is a String, look for
      it in the node&#8216;s body, similar to String#index. Returns the position
      the match starts, or nil if there is no match. Otherwise, invokes obj#=~,
      passing the node&#8216;s body as an argument.
      </p>
    params: ( obj )
  - visibility: public
    aref: M000526
    name: inspect
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 239</span>\n\
      239:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
      240:             <span class=\"ruby-value str\">%Q{&lt;%s Node: %s&gt;}</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-ivar\">@type</span>.<span class=\"ruby-identifier\">capitalize</span>, <span class=\"ruby-ivar\">@body</span>.<span class=\"ruby-identifier\">inspect</span> ]\n\
      241:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return a human-readable version of the object suitable for debugging
      messages.
      </p>
    params: ()
  - visibility: public
    aref: M000523
    name: is_rendering_node?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 219</span>\n\
      219:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">is_rendering_node?</span>\n\
      220:             <span class=\"ruby-keyword kw\">true</span>\n\
      221:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns <tt>true</tt> for nodes which generate output themselves (as
      opposed to ones which generate output through subnodes). This is used for
      eliding blank lines from the node tree.
      </p>
    params: ()
  - visibility: public
    aref: M000525
    name: to_html
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 232</span>\n\
      232:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_html</span>\n\
      233:             <span class=\"ruby-keyword kw\">super</span> { <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">escape_html</span>(<span class=\"ruby-ivar\">@body</span>) }\n\
      234:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return an HTML fragment that can be used to represent the node symbolically
      in a web-based introspection interface.
      </p>
    params: ()
  - visibility: public
    aref: M000524
    name: to_s
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 225</span>\n\
      225:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_s</span>\n\
      226:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">body</span>.<span class=\"ruby-identifier\">to_s</span>\n\
      227:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the node as a String.
      </p>
    params: ()
  category: Instance
  type: Public

sectitle

--- 

constants

--- 
- name: SVNRev
  desc: |+
    
    SVN Revision
    
  value: "%q$Rev: 437 $"
- name: SVNId
  desc: |+
    
    SVN Id
    
  value: "%q$Id: nodes.rb 437 2008-03-28 00:49:20Z deveiant $"

[Validate]

Generated with the Darkfish Rdoc Generator.