Class: Brandish::Processor::Descend Private
- Defined in:
- lib/brandish/processor/descend.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A descent processor. This allows the context to descend into the children of the node as needed. This does not descend into block nodes by default, due to a design decision - that has to be handled by another processor.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(context) ⇒ Descend
constructor
private
Initializes the processor with the given context.
-
#process_root(node) ⇒ Parser::Node::Root
private
Processes the root node.
Methods inherited from Base
#accept, #call, #postprocess, #process_block, #process_command, #process_text, register, #setup
Constructor Details
#initialize(context) ⇒ Descend
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the processor with the given context. This does not adds the processor to the context, and sets the context for use on the processor.
18 19 20 |
# File 'lib/brandish/processor/descend.rb', line 18 def initialize(context) @context = context end |
Instance Method Details
#process_root(node) ⇒ Parser::Node::Root
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Processes the root node. This updates the root node with an updated list of children that have been accepted.
27 28 29 |
# File 'lib/brandish/processor/descend.rb', line 27 def process_root(node) node.update(children: node.children.map { |c| accept(c) }.compact) end |