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::AttributeDirective

The attribute directive superclass. Attribute directives are those that present an exterior interface to the controlling system for message-passing and content-injection (e.g., <?attr?>, <?set?>, <?config?>, etc.)

Constants

SVNRev
SVN Revision
SVNId
SVN Id

Attributes

format[RW]
The format string that was specified with the directive, if any
methodchain[RW]
The source code for the methodchain that will be used to render the attribute.
name[R]
The name of the directive, which is used to associate it with a attribute in the template the node belongs to.

Public Class Methods

allows_format?() click to toggle source

Returns true for classes that support a prepended format. (e.g., <?call "%15s" % foo ?>).

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 402
402:         def self::allows_format?
403:             true
404:         end

Public Instance Methods

before_rendering( template ) click to toggle source

Try to pre-render any attributes which correspond to this node.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 446
446:         def before_rendering( template )
447:             if attrib = template[ self.name ]
448:                 # self.log.debug "  got %s attribute in #before_rendering for %p" %
449:                     # [ attrib.class.name, self.name ]
450: 
451:                 if attrib.respond_to?( :before_rendering )
452:                     # self.log.debug "  pre-rendering attribute %p" % [attrib]
453:                     attrib.before_rendering( template )
454:                 elsif attrib.respond_to?( :each )
455:                     # self.log.debug "  iterating over attribute %p" % [attrib]
456:                     attrib.each do |obj|
457:                         obj.before_rendering if obj.respond_to?( :before_rendering )
458:                     end
459:                 end
460:             else
461:                 # No-op
462:                 # self.log.debug "  no value for node %p in #before_rendering" %
463:                     # self.name
464:             end
465:         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 480
480:         def inspect
481:             %Q{<%s %s%s (Format: %p)>} % [
482:                 @type.capitalize,
483:                 @name,
484:                 @methodchain.strip.empty? ? "" : @methodchain,
485:                 @format,
486:             ]
487:         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 440
440:         def is_rendering_node?
441:             true
442:         end
render( template, scope ) click to toggle source

Render the directive node‘s contents as a String and return it.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 469
469:         def render( template, scope )
470:             # self.log.debug "Rendering %p" % self
471:             rary = super
472: 
473:             rary.push( *(self.render_contents( template, scope )) )
474:             return rary
475:         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 492
492:         def to_html
493:             html = ''
494:             if @format
495:                 html << %q{"%s" %% } % self.escape_html( @format )
496:             end
497:             html << %q{<strong>#%s</strong>} % @name
498:             if @methodchain
499:                 html << self.escape_html( @methodchain )
500:             end
501: 
502:             if block_given?
503:                 html << " " << yield
504:             end
505: 
506:             super { html }
507:         end

Protected Instance Methods

build_rendering_proc( template, scope ) click to toggle source

Build a Proc object that encapsulates the execution necessary to render the directive.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 554
554:         def build_rendering_proc( template, scope )
555:             return nil if self.format.nil? && self.methodchain.nil?
556: 
557:             if self.format
558:                 code = %(Proc.new {|%s| "%s" %% %s%s}) % 
559:                     [ self.name, self.format, self.name, self.methodchain ]
560:             else
561:                 code = "Proc.new {|%s| %s%s}" %
562:                     [ self.name, self.name, self.methodchain ]
563:             end
564:             code.untaint
565: 
566:             #self.log.debug "Rendering proc code is: %p" % code
567:             desc = "[%s (%s): %s]" %
568:                 [ self.class.name, __FILE__, code ]
569: 
570:             return eval( code, scope.get_binding, desc, __LINE__ )
571:         end
call_methodchain( template, scope, *args ) click to toggle source

Call the node‘s methodchain, if any, passing the associated attribute as the first argument and any additional args as second and succeeding arguments. Returns the results of the call.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 577
577:         def call_methodchain( template, scope, *args )
578:             chain = self.build_rendering_proc( template, scope )
579:             # self.log.debug "Rendering proc is: %p" % chain
580: 
581:             # self.log.debug "Fetching attribute %p of template %p" %
582:                 # [ self.name, template ]
583:             attribute = template.send( self.name )
584:             # self.log.debug "Attribute to be rendered (%s) is: %p" %
585:                 # [ self.name, attribute ]
586: 
587:             if chain
588:                 return chain.call( attribute, *args )
589:             else
590:                 return attribute
591:             end
592:         end
initialize( type, parser, state ) click to toggle source

Initialize a new AttributeDirective with the given tag name, template parser, and parser state.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 413
413:         def initialize( type, parser, state ) # :notnew:
414:             @name = nil
415:             @format = nil
416:             @methodchain = nil
417:             super
418:         end
parse_directive_contents( parser, state ) click to toggle source

Parse the contents of the directive, looking for an optional format for tags like <?directive "%-15s" % foo ?>, then a required identifier, then an optional methodchain attached to the identifier.

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 517
517:         def parse_directive_contents( parser, state )
518:             super
519: 
520:             # Look for a format
521:             if self.class.allows_format?
522:                 if fmt = parser.scan_for_quoted_string( state )
523:                     state.scanner.skip( /\s*%\s*/ ) or
524:                         raise Arrow::ParseError, "Format missing modulus operator?"
525:                     @format = fmt[1..-2]
526:                     #self.log.debug "Found format %p" % @format
527:                 else
528:                     #self.log.debug "No format string"
529:                     @format = nil
530:                 end
531:             end
532: 
533:             # Look for the identifier
534:             @name = parser.scan_for_identifier( state ) or
535:                 raise Arrow::ParseError, "missing or malformed indentifier"
536:             #self.log.debug "Set name of %s to %p" %
537:             #    [ self.class.name, @name ]
538: 
539:             # Now pick up the methodchain if there is one
540:             @methodchain = parser.scan_for_methodchain( state )
541: 
542:             return true
543:         end
render_contents( template, scope ) click to toggle source

Render the contents of the node

     # File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 547
547:         def render_contents( template, scope )
548:             return self.call_methodchain( template, scope )
549:         end

secsequence

--- SEC00156

seccomment

--- ""

attributes

--- 
- name: format
  rw: RW
  a_desc: |+
    
    The format string that was specified with the directive, if any
    
- name: methodchain
  rw: RW
  a_desc: |+
    
    The source code for the methodchain that will be used to <a
    href="AttributeDirective.html#M000507">render</a> the attribute.
    
- name: name
  rw: R
  a_desc: |+
    
    The name of the directive, which is used to associate it with a attribute
    in the template the node belongs to.
    

method_list

--- 
- methods: 
  - visibility: public
    aref: M000503
    name: allows_format?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 402</span>\n\
      402:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">allows_format?</span>\n\
      403:             <span class=\"ruby-keyword kw\">true</span>\n\
      404:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns <tt>true</tt> for classes that support a prepended format. (e.g.,
      &lt;?call &quot;%15s&quot; % foo ?&gt;).
      </p>
    params: ()
  category: Class
  type: Public
- methods: 
  - visibility: public
    aref: M000506
    name: before_rendering
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 446</span>\n\
      446:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">before_rendering</span>( <span class=\"ruby-identifier\">template</span> )\n\
      447:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">attrib</span> = <span class=\"ruby-identifier\">template</span>[ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span> ]\n\
      448:                 <span class=\"ruby-comment cmt\"># self.log.debug &quot;  got %s attribute in #before_rendering for %p&quot; %</span>\n\
      449:                     <span class=\"ruby-comment cmt\"># [ attrib.class.name, self.name ]</span>\n\
      450: \n\
      451:                 <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">attrib</span>.<span class=\"ruby-identifier\">respond_to?</span>( <span class=\"ruby-identifier\">:before_rendering</span> )\n\
      452:                     <span class=\"ruby-comment cmt\"># self.log.debug &quot;  pre-rendering attribute %p&quot; % [attrib]</span>\n\
      453:                     <span class=\"ruby-identifier\">attrib</span>.<span class=\"ruby-identifier\">before_rendering</span>( <span class=\"ruby-identifier\">template</span> )\n\
      454:                 <span class=\"ruby-keyword kw\">elsif</span> <span class=\"ruby-identifier\">attrib</span>.<span class=\"ruby-identifier\">respond_to?</span>( <span class=\"ruby-identifier\">:each</span> )\n\
      455:                     <span class=\"ruby-comment cmt\"># self.log.debug &quot;  iterating over attribute %p&quot; % [attrib]</span>\n\
      456:                     <span class=\"ruby-identifier\">attrib</span>.<span class=\"ruby-identifier\">each</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">obj</span><span class=\"ruby-operator\">|</span>\n\
      457:                         <span class=\"ruby-identifier\">obj</span>.<span class=\"ruby-identifier\">before_rendering</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">obj</span>.<span class=\"ruby-identifier\">respond_to?</span>( <span class=\"ruby-identifier\">:before_rendering</span> )\n\
      458:                     <span class=\"ruby-keyword kw\">end</span>\n\
      459:                 <span class=\"ruby-keyword kw\">end</span>\n\
      460:             <span class=\"ruby-keyword kw\">else</span>\n\
      461:                 <span class=\"ruby-comment cmt\"># No-op</span>\n\
      462:                 <span class=\"ruby-comment cmt\"># self.log.debug &quot;  no value for node %p in #before_rendering&quot; %</span>\n\
      463:                     <span class=\"ruby-comment cmt\"># self.name</span>\n\
      464:             <span class=\"ruby-keyword kw\">end</span>\n\
      465:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Try to pre-<a href="AttributeDirective.html#M000507">render</a> any
      attributes which correspond to this node.
      </p>
    params: ( template )
  - visibility: public
    aref: M000508
    name: inspect
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 480</span>\n\
      480:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
      481:             <span class=\"ruby-value str\">%Q{&lt;%s %s%s (Format: %p)&gt;}</span> <span class=\"ruby-operator\">%</span> [\n\
      482:                 <span class=\"ruby-ivar\">@type</span>.<span class=\"ruby-identifier\">capitalize</span>,\n\
      483:                 <span class=\"ruby-ivar\">@name</span>,\n\
      484:                 <span class=\"ruby-ivar\">@methodchain</span>.<span class=\"ruby-identifier\">strip</span>.<span class=\"ruby-identifier\">empty?</span> <span class=\"ruby-value\">? </span><span class=\"ruby-value str\">&quot;&quot;</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-ivar\">@methodchain</span>,\n\
      485:                 <span class=\"ruby-ivar\">@format</span>,\n\
      486:             ]\n\
      487:         <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: M000505
    name: is_rendering_node?
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 440</span>\n\
      440:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">is_rendering_node?</span>\n\
      441:             <span class=\"ruby-keyword kw\">true</span>\n\
      442:         <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: M000507
    name: render
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 469</span>\n\
      469:         <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\
      470:             <span class=\"ruby-comment cmt\"># self.log.debug &quot;Rendering %p&quot; % self</span>\n\
      471:             <span class=\"ruby-identifier\">rary</span> = <span class=\"ruby-keyword kw\">super</span>\n\
      472: \n\
      473:             <span class=\"ruby-identifier\">rary</span>.<span class=\"ruby-identifier\">push</span>( <span class=\"ruby-operator\">*</span>(<span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">render_contents</span>( <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span> )) )\n\
      474:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">rary</span>\n\
      475:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Render the directive node&#8216;s contents as a String and return it.
      </p>
    params: ( template, scope )
  - visibility: public
    aref: M000509
    name: to_html
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 492</span>\n\
      492:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_html</span>\n\
      493:             <span class=\"ruby-identifier\">html</span> = <span class=\"ruby-value str\">''</span>\n\
      494:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@format</span>\n\
      495:                 <span class=\"ruby-identifier\">html</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-value str\">%q{&quot;%s&quot; %% }</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">escape_html</span>( <span class=\"ruby-ivar\">@format</span> )\n\
      496:             <span class=\"ruby-keyword kw\">end</span>\n\
      497:             <span class=\"ruby-identifier\">html</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-value str\">%q{&lt;strong&gt;#%s&lt;/strong&gt;}</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-ivar\">@name</span>\n\
      498:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@methodchain</span>\n\
      499:                 <span class=\"ruby-identifier\">html</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">escape_html</span>( <span class=\"ruby-ivar\">@methodchain</span> )\n\
      500:             <span class=\"ruby-keyword kw\">end</span>\n\
      501: \n\
      502:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span>\n\
      503:                 <span class=\"ruby-identifier\">html</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-value str\">&quot; &quot;</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-keyword kw\">yield</span>\n\
      504:             <span class=\"ruby-keyword kw\">end</span>\n\
      505: \n\
      506:             <span class=\"ruby-keyword kw\">super</span> { <span class=\"ruby-identifier\">html</span> }\n\
      507:         <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: M000512
    name: build_rendering_proc
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 554</span>\n\
      554:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">build_rendering_proc</span>( <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span> )\n\
      555:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">nil</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">format</span>.<span class=\"ruby-identifier\">nil?</span> <span class=\"ruby-operator\">&amp;&amp;</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">methodchain</span>.<span class=\"ruby-identifier\">nil?</span>\n\
      556: \n\
      557:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">format</span>\n\
      558:                 <span class=\"ruby-identifier\">code</span> = <span class=\"ruby-value str\">%(Proc.new {|%s| &quot;%s&quot; %% %s%s})</span> <span class=\"ruby-operator\">%</span> \n\
      559:                     [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">format</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">methodchain</span> ]\n\
      560:             <span class=\"ruby-keyword kw\">else</span>\n\
      561:                 <span class=\"ruby-identifier\">code</span> = <span class=\"ruby-value str\">&quot;Proc.new {|%s| %s%s}&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      562:                     [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">methodchain</span> ]\n\
      563:             <span class=\"ruby-keyword kw\">end</span>\n\
      564:             <span class=\"ruby-identifier\">code</span>.<span class=\"ruby-identifier\">untaint</span>\n\
      565: \n\
      566:             <span class=\"ruby-comment cmt\">#self.log.debug &quot;Rendering proc code is: %p&quot; % code</span>\n\
      567:             <span class=\"ruby-identifier\">desc</span> = <span class=\"ruby-value str\">&quot;[%s (%s): %s]&quot;</span> <span class=\"ruby-operator\">%</span>\n\
      568:                 [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>, <span class=\"ruby-keyword kw\">__FILE__</span>, <span class=\"ruby-identifier\">code</span> ]\n\
      569: \n\
      570:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">eval</span>( <span class=\"ruby-identifier\">code</span>, <span class=\"ruby-identifier\">scope</span>.<span class=\"ruby-identifier\">get_binding</span>, <span class=\"ruby-identifier\">desc</span>, <span class=\"ruby-keyword kw\">__LINE__</span> )\n\
      571:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Build a Proc object that encapsulates the execution necessary to <a
      href="AttributeDirective.html#M000507">render</a> the directive.
      </p>
    params: ( template, scope )
  - visibility: protected
    aref: M000513
    name: call_methodchain
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 577</span>\n\
      577:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">call_methodchain</span>( <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      578:             <span class=\"ruby-identifier\">chain</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">build_rendering_proc</span>( <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span> )\n\
      579:             <span class=\"ruby-comment cmt\"># self.log.debug &quot;Rendering proc is: %p&quot; % chain</span>\n\
      580: \n\
      581:             <span class=\"ruby-comment cmt\"># self.log.debug &quot;Fetching attribute %p of template %p&quot; %</span>\n\
      582:                 <span class=\"ruby-comment cmt\"># [ self.name, template ]</span>\n\
      583:             <span class=\"ruby-identifier\">attribute</span> = <span class=\"ruby-identifier\">template</span>.<span class=\"ruby-identifier\">send</span>( <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span> )\n\
      584:             <span class=\"ruby-comment cmt\"># self.log.debug &quot;Attribute to be rendered (%s) is: %p&quot; %</span>\n\
      585:                 <span class=\"ruby-comment cmt\"># [ self.name, attribute ]</span>\n\
      586: \n\
      587:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">chain</span>\n\
      588:                 <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">chain</span>.<span class=\"ruby-identifier\">call</span>( <span class=\"ruby-identifier\">attribute</span>, <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      589:             <span class=\"ruby-keyword kw\">else</span>\n\
      590:                 <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">attribute</span>\n\
      591:             <span class=\"ruby-keyword kw\">end</span>\n\
      592:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Call the node&#8216;s methodchain, if any, passing the associated attribute
      as the first argument and any additional <tt>args</tt> as second and
      succeeding arguments. Returns the results of the call.
      </p>
    params: ( template, scope, *args )
  - visibility: protected
    aref: M000504
    name: initialize
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 413</span>\n\
      413:         <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> ) <span class=\"ruby-comment cmt\"># :notnew:</span>\n\
      414:             <span class=\"ruby-ivar\">@name</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      415:             <span class=\"ruby-ivar\">@format</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      416:             <span class=\"ruby-ivar\">@methodchain</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      417:             <span class=\"ruby-keyword kw\">super</span>\n\
      418:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Initialize a new <a href="AttributeDirective.html">AttributeDirective</a>
      with the given tag <tt>name</tt>, template <tt>parser</tt>, and parser
      <tt>state</tt>.
      </p>
    params: ( type, parser, state )
  - visibility: protected
    aref: M000510
    name: parse_directive_contents
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 517</span>\n\
      517:         <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\
      518:             <span class=\"ruby-keyword kw\">super</span>\n\
      519: \n\
      520:             <span class=\"ruby-comment cmt\"># Look for a format</span>\n\
      521:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">allows_format?</span>\n\
      522:                 <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">fmt</span> = <span class=\"ruby-identifier\">parser</span>.<span class=\"ruby-identifier\">scan_for_quoted_string</span>( <span class=\"ruby-identifier\">state</span> )\n\
      523:                     <span class=\"ruby-identifier\">state</span>.<span class=\"ruby-identifier\">scanner</span>.<span class=\"ruby-identifier\">skip</span>( <span class=\"ruby-regexp re\">/\\s*%\\s*/</span> ) <span class=\"ruby-keyword kw\">or</span>\n\
      524:                         <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">ParseError</span>, <span class=\"ruby-value str\">&quot;Format missing modulus operator?&quot;</span>\n\
      525:                     <span class=\"ruby-ivar\">@format</span> = <span class=\"ruby-identifier\">fmt</span>[<span class=\"ruby-value\">1</span><span class=\"ruby-operator\">..</span><span class=\"ruby-value\">-2</span>]\n\
      526:                     <span class=\"ruby-comment cmt\">#self.log.debug &quot;Found format %p&quot; % @format</span>\n\
      527:                 <span class=\"ruby-keyword kw\">else</span>\n\
      528:                     <span class=\"ruby-comment cmt\">#self.log.debug &quot;No format string&quot;</span>\n\
      529:                     <span class=\"ruby-ivar\">@format</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      530:                 <span class=\"ruby-keyword kw\">end</span>\n\
      531:             <span class=\"ruby-keyword kw\">end</span>\n\
      532: \n\
      533:             <span class=\"ruby-comment cmt\"># Look for the identifier</span>\n\
      534:             <span class=\"ruby-ivar\">@name</span> = <span class=\"ruby-identifier\">parser</span>.<span class=\"ruby-identifier\">scan_for_identifier</span>( <span class=\"ruby-identifier\">state</span> ) <span class=\"ruby-keyword kw\">or</span>\n\
      535:                 <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">Arrow</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">ParseError</span>, <span class=\"ruby-value str\">&quot;missing or malformed indentifier&quot;</span>\n\
      536:             <span class=\"ruby-comment cmt\">#self.log.debug &quot;Set name of %s to %p&quot; %</span>\n\
      537:             <span class=\"ruby-comment cmt\">#    [ self.class.name, @name ]</span>\n\
      538: \n\
      539:             <span class=\"ruby-comment cmt\"># Now pick up the methodchain if there is one</span>\n\
      540:             <span class=\"ruby-ivar\">@methodchain</span> = <span class=\"ruby-identifier\">parser</span>.<span class=\"ruby-identifier\">scan_for_methodchain</span>( <span class=\"ruby-identifier\">state</span> )\n\
      541: \n\
      542:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">true</span>\n\
      543:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Parse the contents of the directive, looking for an optional format for
      tags like &lt;?directive &quot;%-15s&quot; % foo ?&gt;, then a required
      identifier, then an optional methodchain attached to the identifier.
      </p>
    params: ( parser, state )
  - visibility: protected
    aref: M000511
    name: render_contents
    sourcecode: "     <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/nodes.rb, line 547</span>\n\
      547:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">render_contents</span>( <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span> )\n\
      548:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">call_methodchain</span>( <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span> )\n\
      549:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Render the contents of the node
      </p>
    params: ( template, scope )
  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.