Class: Brandish::Processor::Descend Private

Inherits:
Base
  • Object
show all
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

#context

Instance Method Summary collapse

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.

Parameters:



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.

Parameters:

Returns:



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