Class: Lisp::Format::Directives::ArgJump
- Defined in:
- lib/carat/lisp-format.rb
Overview
Represents the ~* (Argument jumping) directive. This moves arbitrarily amongst the arguments passed to the formatting engine.
Instance Attribute Summary
Attributes inherited from Directive
Instance Method Summary collapse
-
#execute(state) ⇒ Object
Moves backwards or forwards, relative or absolute, among the formatting arguments.
Methods inherited from Directive
Constructor Details
This class inherits a constructor from Lisp::Format::Directives::Directive
Instance Method Details
#execute(state) ⇒ Object
Moves backwards or forwards, relative or absolute, among the formatting arguments. The full form is
~n:@*
with the following interpretations
n
(1)-
the amount of arguments to move or the argument to move to if moving to an absolute position, indexed from zero (0),
- :
-
move backwards
n
arguments - @
-
move to the
n
:th argument, using zero-based indexing (absolute).
1400 1401 1402 1403 |
# File 'lib/carat/lisp-format.rb', line 1400 def execute(state) n = param(0, state, 1) state.args_move(colon_mod? ? -n : n, !at_mod?) end |