Sha256: 092d471657c313fd7ac66ca4701f999ac2656adfccc0b0b272e0900852d3012c
Contents?: true
Size: 1009 Bytes
Versions: 3
Compression:
Stored size: 1009 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module Brandish module Processor # 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. # # @api private class Descend < Base # 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. # # @param context [Context] def initialize(context) @context = context end # Processes the root node. This updates the root node with an updated # list of children that have been accepted. # # @param node [Parser::Node::Root] # @return [Parser::Node::Root] def process_root(node) node.update(children: node.children.map { |c| accept(c) }.compact) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
brandish-0.1.3 | lib/brandish/processor/descend.rb |
brandish-0.1.2 | lib/brandish/processor/descend.rb |
brandish-0.1.1 | lib/brandish/processor/descend.rb |