Class Lisp::Format::Directives::BeginIteration
In: lib/facet/lisp-format.rb
Parent: Directive

Represents the ~{ (Begin iteration) directive. A given set of directives is used iteratively over a set of arguments (depends on the modifiers specified) a given number of times, or until it runs out of arguments.

Methods

Public Class methods

Create and set up some private variables

Public Instance methods

Connect a set of directives to this iteration directive.

Iteratively run the contained directives using sets of arguments depending upon what modifiers where given. The full form is

  ~n:@{...~}

with the following interpretations

n
maximum number of times the iteration should be performed,
no modifiers
the iteration reads an argument, which must be an Array, and uses it as the arguments to the contained directives,
:
the iteration reads an argument, which must be an Array containing sub-arrays, and uses the sub-arrays as the arguments to the contained directives, moving to the next one on each iteration,
@
the iteration uses the rest of the arguments as arguments to the contained directives,
:@
the iteration uses the rest of the arguments, which must be Arrays, using each Array as the set of arguments to the contained directives.

Private Instance methods

Execute the iteration while there are arguments left and we haven’t reached our limit of iterations.

Execute the iteration using sub-lists either from the following argument or from the remaining arguments.

[Validate]