Class: Arrow::Template::RenderDirective

Inherits:
AttributeDirective show all
Includes:
Parser::Patterns
Defined in:
lib/arrow/template/render.rb

Overview

The Arrow::Template::RenderDirective class, a derivative of Arrow::Template::Directive. This is the class which defines the behaviour of the ‘render’ template directive.

Syntax

<?render foo as bar in baz.tmpl ?>

VCS Id

$Id$

Authors

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

Constant Summary collapse

AS =

Parse tokens

/\s+as\s+/i
IN =
/in/i

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 inherited from AttributeDirective

AttributeDirective::SVNId, AttributeDirective::SVNRev

Constants inherited from Directive

Directive::SVNId, Directive::SVNRev

Constants inherited from Node

Node::SVNId, Node::SVNRev

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 collapse

Attributes inherited from AttributeDirective

#format, #methodchain, #name

Attributes inherited from Node

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AttributeDirective

#before_rendering, #is_rendering_node?, #render, #to_html

Methods inherited from Directive

create, derivativeDirs, #render, #to_html

Methods inherited from Node

#add_to_template, #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

#initialize(type, parser, state) ⇒ RenderDirective

Create a new RenderDirective object.



46
47
48
49
50
51
52
53
# File 'lib/arrow/template/render.rb', line 46

def initialize( type, parser, state )
	@target = nil
	@subtemplate = nil

	state[:templateCache] ||= {}

	super
end

Instance Attribute Details

#subtemplateObject (readonly)

An Array of Regexp objects which match the names of attributes to be rendered.



62
63
64
# File 'lib/arrow/template/render.rb', line 62

def subtemplate
  @subtemplate
end

Class Method Details

.allows_format?Boolean

Disallow formats

Returns:

  • (Boolean)


38
# File 'lib/arrow/template/render.rb', line 38

def self::allows_format?; false; end

Instance Method Details

#inspectObject

Return a human-readable version of the object suitable for debugging messages.



67
68
69
70
71
72
73
74
75
# File 'lib/arrow/template/render.rb', line 67

def inspect
	%Q{<%s %s%s as %s in %s>} % [
		@type.capitalize,
		@name,
		@methodchain.strip.empty? ? "" : "." + @methodchain,
		@target,
		@subtemplate._file,
	]
end