Class: Arrow::Template::ExportDirective

Inherits:
BracketingDirective show all
Includes:
Parser::Patterns
Defined in:
lib/arrow/template/export.rb

Overview

The Arrow::Template::ExportDirective class, a derivative of Arrow::Template::BracketingDirective. This is the class which defines the behaviour of the ‘export’ template directive.

Syntax

  <!-- Some content for 'foo' attributes of enclosing templates. -->

VCS Id

$Id$

Authors

  • Michael Granger

Please see the file LICENSE in the top-level directory for licensing details.

Constant Summary

SVNRev =

SVN Revision

%q$Rev$
SVNId =

SVN Id

%q$Id$

Constants included from Parser::Patterns

ALTERNATION, ARGDEFAULT, ARGUMENT, CAPTURE, COMMA, DBLQSTRING, DOT, EQUALS, IDENTIFIER, INFIX, LBRACKET, NUMBER, PATHNAME, QUOTEDSTRING, RBRACKET, REBINDOP, REGEXP, SLASHQSTRING, SYMBOL, TAGCLOSE, TAGMIDDLE, TAGOPEN, TICKQSTRING, VARIABLE, WHITESPACE

Constants inherited from BracketingDirective

SVNId, SVNRev

Constants inherited from AttributeDirective

SVNId, SVNRev

Constants inherited from Directive

SVNId, SVNRev

Constants inherited from Node

SVNId, SVNRev

Constants included from Arrow::HTMLUtilities

ARRAY_HTML_CONTAINER, HASH_HTML_CONTAINER, HASH_PAIR_HTML, IMMEDIATE_OBJECT_HTML_CONTAINER, IVAR_HTML_FRAGMENT, OBJECT_HTML_CONTAINER, THREAD_DUMP_KEY

Class Method Summary

Instance Method Summary

Methods inherited from BracketingDirective

#initialize, #inspect, #is_rendering_node?, #parse_directive_contents, #render_subnodes, #to_a, #to_html

Methods inherited from AttributeDirective

#build_rendering_proc, #call_methodchain, #initialize, #inspect, #is_rendering_node?, #parse_directive_contents, #render, #to_html

Methods inherited from Directive

create, derivativeDirs, #initialize, #inspect, #parse_directive_contents, #render, #to_html

Methods inherited from Node

#css_class, #initialize, #inspect, #is_rendering_node?, #render, #to_a, #to_html, #to_s

Methods included from Arrow::HTMLUtilities

#escape_html, #make_html_for_object, #make_object_html_wrapper

Methods inherited from Arrow::Object

deprecate_class_method, deprecate_method, inherited

Methods included from Arrow::Loggable

#log

Constructor Details

This class inherits a constructor from Arrow::Template::BracketingDirective

Class Method Details

+ (Boolean) allows_format?

Disallow formats and methodchains

Returns:

  • (Boolean)


44
# File 'lib/arrow/template/export.rb', line 44

def self::allows_format?; false end

+ (Boolean) allows_method_chains?

Returns:

  • (Boolean)


45
# File 'lib/arrow/template/export.rb', line 45

def self::allows_method_chains?; false end

Instance Method Details

- (Object) add_to_template(template)

Add attributes contained by subnodes, but not the attribute for this node itself, which will be looked for in the enclosing template.



68
69
70
71
72
# File 'lib/arrow/template/export.rb', line 68

def add_to_template( template ) # :nodoc:
  self.subnodes.each do |node|
    template.install_node( node )
  end
end

- (Object) before_rendering(template)

Add the imported attributes when this node is rendered.



53
54
55
56
57
58
59
60
61
62
# File 'lib/arrow/template/export.rb', line 53

def before_rendering( template )
  st = template
  
  while st = st._enclosing_template
    surrogate = template.class.new( self.subnodes )
  
    # :TODO: Does appending to the attribute make more sense?
    st._attributes[ self.name ] = surrogate
  end
end

- (Object) render_contents(template, scope) (protected)

Override the default behavior, which is to render subnodes. Since the whole point of this directive is to give content to a containing template, this becomes a no-op.



82
83
84
# File 'lib/arrow/template/export.rb', line 82

def render_contents( template, scope )
  return []
end