Class: Arrow::Template::YieldDirective

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

Overview

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

Syntax

<?yield <args> from <attribute>.<block_method> ?>

The args portion is similar to Ruby argument lists: it supports defaults, *vars, and hash arguments.

Examples

<!-- Iterate over the incoming headers of an Apache::Request -->
<?yield name, value from request.headers_in.each ?>
  <?attr name ?>: <?escape value ?>
<?end yield?>

Authors

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

Constant Summary collapse

FROM =

The regexp format of the ‘yield’ part of the directive tag.

WHITESPACE + /from/i + WHITESPACE

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 BracketingDirective

BracketingDirective::SVNId, BracketingDirective::SVNRev

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

#add_to_template, #inspect, #is_rendering_node?, #to_a, #to_html

Methods inherited from AttributeDirective

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

Methods inherited from Directive

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

Methods inherited from Node

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

#initialize(type, parser, state) ⇒ YieldDirective

Initialize a new YieldDirective object with the specified type, parser, and state.



55
56
57
58
59
# File 'lib/arrow/template/yield.rb', line 55

def initialize( type, parser, state )
	@args = []
	@pureargs = []
	super
end

Instance Attribute Details

#argsObject (readonly)

The argument list for the yield block, with sigils and defaults, if any.



67
68
69
# File 'lib/arrow/template/yield.rb', line 67

def args
  @args
end

#pureargsObject (readonly)

The argument list for the callback, with any sigils and defaults stripped away.



71
72
73
# File 'lib/arrow/template/yield.rb', line 71

def pureargs
  @pureargs
end

Class Method Details

.allows_format?Boolean

Returns false; disallows prepended formats.

Returns:

  • (Boolean)


44
45
46
# File 'lib/arrow/template/yield.rb', line 44

def self::allows_format?
	false
end