Subversion Info

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

Included Modules

Class Index

Quicksearch

Arrow::Template::Directive

The abstract directive superclass. Instances of derivatives of this class define template behaviour and content.

Constants

SVNRev
SVN Revision
SVNId
SVN Id

Public Class Methods

create( tag, parser, state ) click to toggle source

Factory method: overridden from PluginFactory.create to pass the name into constructors for parsing context.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 311
311:         def self::create( tag, parser, state )
312:             super( tag, tag, parser, state )
313:         end
derivativeDirs() click to toggle source

Return the list of subdirectories to search for template nodes.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 304
304:         def self::derivativeDirs
305:             ["arrow/template"]
306:         end
new( type, parser, state ) click to toggle source

Initialize a new Directive with the given type (the directive name), parser (Arrow::Template::Parser), and state (Arrow::Template::Parser::State object).

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 323
323:         def initialize( type, parser, state )
324:             super( type )
325:             self.parse_directive_contents( parser, state )
326:         end

Public Instance Methods

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 345
345:         def inspect
346:             %Q{<%s Directive>} % [ @type.capitalize ]
347:         end
render( template, scope ) click to toggle source

Render the directive as a String and return it.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 334
334:         def render( template, scope )
335:             rary = []
336:             rary << template.render_comment( self.inspect ) if
337:                 template._config[:debuggingComments]
338:             
339:             return rary
340:         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 352
352:         def to_html
353: 
354:             if block_given?
355:                 callback = Proc.new
356:                 super( &callback )
357:             else
358:                 fields = instance_variables.sort.collect {|ivar|
359:                     val = instance_variable_get( ivar )
360:                     %q{<span class="ivar"><em>%s:</em> %s</span>} %
361:                         [ ivar, self.escape_html(val) ]
362:                 }
363: 
364:                 super { fields.join(", ") }
365:             end
366:         end

Protected Instance Methods

parse_directive_contents( parser, state ) click to toggle source

Parse the contents of the directive. This is a no-op for this class; it‘s here to allow delegation of this task to subclasses.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 375
375:         def parse_directive_contents( parser, state )
376:         end

secsequence

--- SEC00155

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000515
    name: create
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 311</span>\n\
      311:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">create</span>( <span class=\"ruby-identifier\">tag</span>, <span class=\"ruby-identifier\">parser</span>, <span class=\"ruby-identifier\">state</span> )\n\
      312:             <span class=\"ruby-keyword kw\">super</span>( <span class=\"ruby-identifier\">tag</span>, <span class=\"ruby-identifier\">tag</span>, <span class=\"ruby-identifier\">parser</span>, <span class=\"ruby-identifier\">state</span> )\n\
      313:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Factory method: overridden from PluginFactory.create to pass the name into
      constructors for parsing context.
      </p>
    params: ( tag, parser, state )
  - visibility: public
    aref: M000514
    name: derivativeDirs
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 304</span>\n\
      304:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">derivativeDirs</span>\n\
      305:             [<span class=\"ruby-value str\">&quot;arrow/template&quot;</span>]\n\
      306:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the list of subdirectories to search for template nodes.
      </p>
    params: ()
  - visibility: public
    aref: M000516
    name: new
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 323</span>\n\
      323:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">type</span>, <span class=\"ruby-identifier\">parser</span>, <span class=\"ruby-identifier\">state</span> )\n\
      324:             <span class=\"ruby-keyword kw\">super</span>( <span class=\"ruby-identifier\">type</span> )\n\
      325:             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">parse_directive_contents</span>( <span class=\"ruby-identifier\">parser</span>, <span class=\"ruby-identifier\">state</span> )\n\
      326:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Initialize a <a href="Directive.html#M000516">new</a> <a
      href="Directive.html">Directive</a> with the given <tt>type</tt> (the
      directive name), <tt>parser</tt> (<a
      href="Parser.html">Arrow::Template::Parser</a>), and <tt>state</tt> (<a
      href="Parser/State.html">Arrow::Template::Parser::State</a> object).
      </p>
    params: ( type, parser, state )
  category: Class
  type: Public
- methods: 
  - visibility: public
    aref: M000518
    name: inspect
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 345</span>\n\
      345:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
      346:             <span class=\"ruby-value str\">%Q{&lt;%s Directive&gt;}</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-ivar\">@type</span>.<span class=\"ruby-identifier\">capitalize</span> ]\n\
      347:         <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: M000517
    name: render
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 334</span>\n\
      334:         <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\
      335:             <span class=\"ruby-identifier\">rary</span> = []\n\
      336:             <span class=\"ruby-identifier\">rary</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-identifier\">template</span>.<span class=\"ruby-identifier\">render_comment</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">inspect</span> ) <span class=\"ruby-keyword kw\">if</span>\n\
      337:                 <span class=\"ruby-identifier\">template</span>.<span class=\"ruby-identifier\">_config</span>[<span class=\"ruby-identifier\">:debuggingComments</span>]\n\
      338:             \n\
      339:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">rary</span>\n\
      340:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Render the directive as a String and return it.
      </p>
    params: ( template, scope )
  - visibility: public
    aref: M000519
    name: to_html
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 352</span>\n\
      352:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_html</span>\n\
      353: \n\
      354:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span>\n\
      355:                 <span class=\"ruby-identifier\">callback</span> = <span class=\"ruby-constant\">Proc</span>.<span class=\"ruby-identifier\">new</span>\n\
      356:                 <span class=\"ruby-keyword kw\">super</span>( <span class=\"ruby-operator\">&amp;</span><span class=\"ruby-identifier\">callback</span> )\n\
      357:             <span class=\"ruby-keyword kw\">else</span>\n\
      358:                 <span class=\"ruby-identifier\">fields</span> = <span class=\"ruby-identifier\">instance_variables</span>.<span class=\"ruby-identifier\">sort</span>.<span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">ivar</span><span class=\"ruby-operator\">|</span>\n\
      359:                     <span class=\"ruby-identifier\">val</span> = <span class=\"ruby-identifier\">instance_variable_get</span>( <span class=\"ruby-identifier\">ivar</span> )\n\
      360:                     <span class=\"ruby-value str\">%q{&lt;span class=&quot;ivar&quot;&gt;&lt;em&gt;%s:&lt;/em&gt; %s&lt;/span&gt;}</span> <span class=\"ruby-operator\">%</span>\n\
      361:                         [ <span class=\"ruby-identifier\">ivar</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">escape_html</span>(<span class=\"ruby-identifier\">val</span>) ]\n\
      362:                 }\n\
      363: \n\
      364:                 <span class=\"ruby-keyword kw\">super</span> { <span class=\"ruby-identifier\">fields</span>.<span class=\"ruby-identifier\">join</span>(<span class=\"ruby-value str\">&quot;, &quot;</span>) }\n\
      365:             <span class=\"ruby-keyword kw\">end</span>\n\
      366:         <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: ()
  category: Instance
  type: Public
- methods: 
  - visibility: protected
    aref: M000520
    name: parse_directive_contents
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 375</span>\n\
      375:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">parse_directive_contents</span>( <span class=\"ruby-identifier\">parser</span>, <span class=\"ruby-identifier\">state</span> )\n\
      376:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Parse the contents of the directive. This is a no-op for this class;
      it&#8216;s here to allow delegation of this task to subclasses.
      </p>
    params: ( parser, state )
  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.