The abstract base node class.
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
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
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
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
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
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
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
--- SEC00152
--- ""
--- - name: type rw: R a_desc: |+ The type of the node
--- - 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\">"<%s Node>"</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\">""</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{<div class="node %s"><div class="node-head %s-head">%s</div>\n\ 139: <div class="node-body %s-body">%s</div></div>}</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\">""</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\">"\\\\1-\\\\2"</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\"><<</span> <span class=\"ruby-value str\">"-node"</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
---
--- - 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 $"
Generated with the Darkfish Rdoc Generator.