Class: Coradoc::Reference::Resolution
- Inherits:
-
Object
- Object
- Coradoc::Reference::Resolution
- Defined in:
- lib/coradoc/reference/resolution.rb
Overview
Orchestrator: resolves every Edge in the tree via the Resolver, enforces the missing/ambiguous policies, and — only when asked to materialize — rebuilds the tree with rendered inline nodes via the Presentation layout and the Materializer registry.
Two-step contract:
materialize: falsevalidates references and returns the INPUT document (never mutated, never copied).materialize: truereturns a NEW document. Untouched subtrees are shared with the input (structural sharing) — treat both as immutable.
Wired from the public API Coradoc.resolve_references.
Defined Under Namespace
Classes: ReplaceWalker
Instance Attribute Summary collapse
-
#ambiguous_policy ⇒ Object
readonly
Returns the value of attribute ambiguous_policy.
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#materialize_policy ⇒ Object
readonly
Returns the value of attribute materialize_policy.
-
#materializer_registry ⇒ Object
readonly
Returns the value of attribute materializer_registry.
-
#missing_policy ⇒ Object
readonly
Returns the value of attribute missing_policy.
-
#presentation ⇒ Object
readonly
Returns the value of attribute presentation.
-
#resolver ⇒ Object
readonly
Returns the value of attribute resolver.
Instance Method Summary collapse
- #call(document) ⇒ Object
-
#initialize(catalog:, presentation:, missing:, ambiguous:, materialize:, resolver: nil, format: nil, materializer_registry: default_registry) ⇒ Resolution
constructor
A new instance of Resolution.
Constructor Details
#initialize(catalog:, presentation:, missing:, ambiguous:, materialize:, resolver: nil, format: nil, materializer_registry: default_registry) ⇒ Resolution
Returns a new instance of Resolution.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/coradoc/reference/resolution.rb', line 23 def initialize(catalog:, presentation:, missing:, ambiguous:, materialize:, resolver: nil, format: nil, materializer_registry: default_registry) @catalog = catalog @presentation = presentation @missing_policy = missing @ambiguous_policy = ambiguous @materialize_policy = materialize @format = format @materializer_registry = materializer_registry @resolver = resolver || Resolver::Catalog.new( catalog: catalog, ambiguous: ambiguous, missing: missing ) end |
Instance Attribute Details
#ambiguous_policy ⇒ Object (readonly)
Returns the value of attribute ambiguous_policy.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def ambiguous_policy @ambiguous_policy end |
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def catalog @catalog end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def format @format end |
#materialize_policy ⇒ Object (readonly)
Returns the value of attribute materialize_policy.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def materialize_policy @materialize_policy end |
#materializer_registry ⇒ Object (readonly)
Returns the value of attribute materializer_registry.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def materializer_registry @materializer_registry end |
#missing_policy ⇒ Object (readonly)
Returns the value of attribute missing_policy.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def missing_policy @missing_policy end |
#presentation ⇒ Object (readonly)
Returns the value of attribute presentation.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def presentation @presentation end |
#resolver ⇒ Object (readonly)
Returns the value of attribute resolver.
19 20 21 |
# File 'lib/coradoc/reference/resolution.rb', line 19 def resolver @resolver end |
Instance Method Details
#call(document) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/coradoc/reference/resolution.rb', line 38 def call(document) results = resolve_all_edges(document) report_missing(results) return document unless materialize_policy materialize_tree(document, results) end |