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

<?export foo ?>

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

<?end?>

VCS Id

$Id$

Authors

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

Constant Summary collapse

SVNRev =

SVN Revision

%q$Rev$
SVNId =

SVN Id

%q$Id$

Constants included from Parser::Patterns

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

Constants included from HTMLUtilities

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

Instance Attribute Summary

Attributes inherited from BracketingDirective

#subnodes

Attributes inherited from AttributeDirective

#format, #methodchain, #name

Attributes inherited from Node

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BracketingDirective

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

Methods inherited from AttributeDirective

#initialize, #inspect, #is_rendering_node?, #render, #to_html

Methods inherited from Directive

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

Methods inherited from Node

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

Methods included from HTMLUtilities

escape_html, make_html_for_object, make_object_html_wrapper

Methods inherited from Object

deprecate_class_method, deprecate_method, inherited

Constructor Details

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

Class Method Details

.allows_format?Boolean

Disallow formats and methodchains

Returns:

  • (Boolean)


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

def self::allows_format?; false; end

.allows_method_chains?Boolean

Returns:

  • (Boolean)


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

def self::allows_method_chains?; false; end

Instance Method Details

#add_to_template(template) ⇒ Object

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

#before_rendering(template) ⇒ Object

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