Class: Coradoc::Reference::Resolution::ReplaceWalker
- Inherits:
-
Object
- Object
- Coradoc::Reference::Resolution::ReplaceWalker
- Defined in:
- lib/coradoc/reference/resolution.rb
Overview
Rebuilds the tree, replacing every Edge-bearing node with the materializer's output. The walker is single-purpose and only lives inside Resolution — no need for a separate file.
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#missing_policy ⇒ Object
readonly
Returns the value of attribute missing_policy.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#presentation ⇒ Object
readonly
Returns the value of attribute presentation.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(pages:, results:, presentation:, registry:, missing_policy:, format:) ⇒ ReplaceWalker
constructor
A new instance of ReplaceWalker.
- #visit(node) ⇒ Object
Constructor Details
#initialize(pages:, results:, presentation:, registry:, missing_policy:, format:) ⇒ ReplaceWalker
Returns a new instance of ReplaceWalker.
96 97 98 99 100 101 102 103 104 |
# File 'lib/coradoc/reference/resolution.rb', line 96 def initialize(pages:, results:, presentation:, registry:, missing_policy:, format:) @pages = pages @results = results @presentation = presentation @registry = registry @missing_policy = missing_policy @format = format end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
93 94 95 |
# File 'lib/coradoc/reference/resolution.rb', line 93 def format @format end |
#missing_policy ⇒ Object (readonly)
Returns the value of attribute missing_policy.
93 94 95 |
# File 'lib/coradoc/reference/resolution.rb', line 93 def missing_policy @missing_policy end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
93 94 95 |
# File 'lib/coradoc/reference/resolution.rb', line 93 def pages @pages end |
#presentation ⇒ Object (readonly)
Returns the value of attribute presentation.
93 94 95 |
# File 'lib/coradoc/reference/resolution.rb', line 93 def presentation @presentation end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
93 94 95 |
# File 'lib/coradoc/reference/resolution.rb', line 93 def registry @registry end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
93 94 95 |
# File 'lib/coradoc/reference/resolution.rb', line 93 def results @results end |
Instance Method Details
#visit(node) ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/coradoc/reference/resolution.rb', line 106 def visit(node) return node unless node.is_a?(Coradoc::CoreModel::Base) replaced = replace_node(node) return replaced unless replaced.is_a?(Coradoc::CoreModel::HasChildren) rebuild_children_of(replaced) end |