Class: Lisp::Format::Directives::Indirection
- Defined in:
- lib/carat/lisp-format.rb
Overview
Represents the ~? (Indirection) directive. This takes the two following arguments and formats them, using the first as the formatting string, and the second as its arguments and inserts it into the output.
Instance Attribute Summary
Attributes inherited from Directive
Instance Method Summary collapse
-
#execute(state) ⇒ Object
Uses the next argument as a formatting string and then, depending on modifiers specified, uses one of a set of different arguments as input to this formatting.
Methods inherited from Directive
Constructor Details
This class inherits a constructor from Lisp::Format::Directives::Directive
Instance Method Details
#execute(state) ⇒ Object
Uses the next argument as a formatting string and then, depending on modifiers specified, uses one of a set of different arguments as input to this formatting. The full form is
~@?
with the following interpretations
- @
-
the formatting string is, much like a macro, inserted into the formatting stream, so to speak, and consumes arguments and so on from the current state, instead, as per default, consuming a second argument and reading arguments from it.
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 |
# File 'lib/carat/lisp-format.rb', line 1420 def execute(state) if at_mod? formatter = Formatter.new(state.next_arg, state) else format = state.next_arg state = State.new(state.next_arg, state.latest_output) formatter = Formatter.new(format, state) end formatter.run end |