Subversion Info

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

Parent

Included Modules

Class Index

Quicksearch

Arrow::Template::Node

The abstract base node class.

Constants

SVNRev
SVN Revision
SVNId
SVN Id

Attributes

type[R]
The type of the node

Public Instance Methods

add_to_template( template ) click to toggle source

Install the node object into the given template object.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 95
95:         def add_to_template( template )
96:             template.install_node( self )
97:         end
inspect() click to toggle source

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

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 120
120:         def inspect
121:             "<%s Node>" % @type.capitalize
122:         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 88
88:         def is_rendering_node?
89:             false
90:         end
Also aliased as: rendering?
render( template, scope ) click to toggle source

Render the node to text.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 113
113:         def render( template, scope )
114:             return [ self.to_s ]
115:         end
rendering?() click to toggle source

Alias for #is_rendering_node?

to_a() click to toggle source

Return the receiver and any subnodes as a flattened Array of nodes.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 107
107:         def to_a
108:             [self]
109:         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 127
127:         def to_html
128:             content = nil
129: 
130:             if block_given? 
131:                 content = yield
132:             else
133:                 content = ""
134:             end
135: 
136:             nodeclass = self.css_class
137: 
138:             %q{<div class="node %s"><div class="node-head %s-head">%s</div>
139:                 <div class="node-body %s-body">%s</div></div>} % [
140:                 nodeclass, nodeclass,
141:                 self.class.name.sub(/Arrow::Template::/, ''),
142:                 nodeclass,
143:                 content,
144:             ]
145:         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 101
101:         def to_s
102:             ""
103:         end

Protected Instance Methods

css_class() click to toggle source

Return the HTML element class attribute that corresponds to this node.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 153
153:         def css_class
154:             nodeclass = self.class.name.
155:                 sub(/Arrow::Template::/, '').
156:                 gsub( /::/, '-' ).
157:                 gsub( /([a-z])([A-Z])/, "\\1-\\2" ).
158:                 gsub( /[^-\w]+/, '' ).
159:                 downcase
160:             nodeclass << "-node" unless /-node$/.match( nodeclass )
161: 
162:             return nodeclass
163:         end
initialize( type='generic' ) click to toggle source

Provide initialization for all derivative Arrow::Template::Node objects.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 71
71:         def initialize( type='generic' ) # :notnew:
72:             @type = type
73:             super()
74:         end

secsequence

--- SEC00152

seccomment

--- ""

attributes

--- 
- name: type
  rw: R
  a_desc: |+
    
    The type of the node
    

method_list

--- 
- methods: 
  - visibility: public
    aref: M000482
    name: add_to_template
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 95</span>\n\
      95:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">add_to_template</span>( <span class=\"ruby-identifier\">template</span> )\n\
      96:             <span class=\"ruby-identifier\">template</span>.<span class=\"ruby-identifier\">install_node</span>( <span class=\"ruby-keyword kw\">self</span> )\n\
      97:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Install the node object into the given <tt>template</tt> object.
      </p>
    params: ( template )
  - visibility: public
    aref: M000486
    name: inspect
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 120</span>\n\
      120:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
      121:             <span class=\"ruby-value str\">&quot;&lt;%s Node&gt;&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-ivar\">@type</span>.<span class=\"ruby-identifier\">capitalize</span>\n\
      122:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return a human-readable version of the <a href="Node.html">Node</a> object
      suitable for debugging messages.
      </p>
    params: ()
  - visibility: public
    aref: M000480
    name: is_rendering_node?
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 88</span>\n\
      88:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">is_rendering_node?</span>\n\
      89:             <span class=\"ruby-keyword kw\">false</span>\n\
      90:         <span class=\"ruby-keyword kw\">end</span>"
    aka: 
    - aref: Node.html#M000481
      name: rendering?
    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: M000485
    name: render
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 113</span>\n\
      113:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">render</span>( <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span> )\n\
      114:             <span class=\"ruby-keyword kw\">return</span> [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">to_s</span> ]\n\
      115:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Render the node to text.
      </p>
    params: ( template, scope )
  - visibility: public
    aref: M000481
    name: rendering?
    m_desc: |-
      <p>
      Alias for #is_rendering_node?
      </p>
    params: ()
  - visibility: public
    aref: M000484
    name: to_a
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 107</span>\n\
      107:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_a</span>\n\
      108:             [<span class=\"ruby-keyword kw\">self</span>]\n\
      109:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the receiver and any subnodes as a flattened Array of nodes.
      </p>
    params: ()
  - visibility: public
    aref: M000487
    name: to_html
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 127</span>\n\
      127:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_html</span>\n\
      128:             <span class=\"ruby-identifier\">content</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      129: \n\
      130:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span> \n\
      131:                 <span class=\"ruby-identifier\">content</span> = <span class=\"ruby-keyword kw\">yield</span>\n\
      132:             <span class=\"ruby-keyword kw\">else</span>\n\
      133:                 <span class=\"ruby-identifier\">content</span> = <span class=\"ruby-value str\">&quot;&quot;</span>\n\
      134:             <span class=\"ruby-keyword kw\">end</span>\n\
      135: \n\
      136:             <span class=\"ruby-identifier\">nodeclass</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">css_class</span>\n\
      137: \n\
      138:             <span class=\"ruby-value str\">%q{&lt;div class=&quot;node %s&quot;&gt;&lt;div class=&quot;node-head %s-head&quot;&gt;%s&lt;/div&gt;\n\
      139:                 &lt;div class=&quot;node-body %s-body&quot;&gt;%s&lt;/div&gt;&lt;/div&gt;}</span> <span class=\"ruby-operator\">%</span> [\n\
      140:                 <span class=\"ruby-identifier\">nodeclass</span>, <span class=\"ruby-identifier\">nodeclass</span>,\n\
      141:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>.<span class=\"ruby-identifier\">sub</span>(<span class=\"ruby-regexp re\">/Arrow::Template::/</span>, <span class=\"ruby-value str\">''</span>),\n\
      142:                 <span class=\"ruby-identifier\">nodeclass</span>,\n\
      143:                 <span class=\"ruby-identifier\">content</span>,\n\
      144:             ]\n\
      145:         <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: M000483
    name: to_s
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 101</span>\n\
      101:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_s</span>\n\
      102:             <span class=\"ruby-value str\">&quot;&quot;</span>\n\
      103:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the node as a String.
      </p>
    params: ()
  category: Instance
  type: Public
- methods: 
  - visibility: protected
    aref: M000488
    name: css_class
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 153</span>\n\
      153:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">css_class</span>\n\
      154:             <span class=\"ruby-identifier\">nodeclass</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>.\n\
      155:                 <span class=\"ruby-identifier\">sub</span>(<span class=\"ruby-regexp re\">/Arrow::Template::/</span>, <span class=\"ruby-value str\">''</span>).\n\
      156:                 <span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">/::/</span>, <span class=\"ruby-value str\">'-'</span> ).\n\
      157:                 <span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">/([a-z])([A-Z])/</span>, <span class=\"ruby-value str\">&quot;\\\\1-\\\\2&quot;</span> ).\n\
      158:                 <span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">/[^-\\w]+/</span>, <span class=\"ruby-value str\">''</span> ).\n\
      159:                 <span class=\"ruby-identifier\">downcase</span>\n\
      160:             <span class=\"ruby-identifier\">nodeclass</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-value str\">&quot;-node&quot;</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-regexp re\">/-node$/</span>.<span class=\"ruby-identifier\">match</span>( <span class=\"ruby-identifier\">nodeclass</span> )\n\
      161: \n\
      162:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">nodeclass</span>\n\
      163:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the HTML element class attribute that corresponds to this node.
      </p>
    params: ()
  - visibility: protected
    aref: M000479
    name: initialize
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 71</span>\n\
      71:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">type</span>=<span class=\"ruby-value str\">'generic'</span> ) <span class=\"ruby-comment cmt\"># :notnew:</span>\n\
      72:             <span class=\"ruby-ivar\">@type</span> = <span class=\"ruby-identifier\">type</span>\n\
      73:             <span class=\"ruby-keyword kw\">super</span>()\n\
      74:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Provide initialization for all derivative Arrow::Template::Node objects.
      </p>
    params: ( type='generic' )
  category: Instance
  type: Protected

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.