Class: Coradoc::Reference::Materializer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/reference/materializer/base.rb

Overview

Protocol base. Subclasses declare their (kind, presentation, format) tuple via class-level .kind, .presentation, .format methods, then implement #materialize to produce a CoreModel::InlineElement subtree.

Materializers consume Results — they never touch the catalog directly. The Presentation tells them where the target lives.

Direct Known Subclasses

Passthrough

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.formatObject



23
24
25
# File 'lib/coradoc/reference/materializer/base.rb', line 23

def format
  :any
end

.kindObject



15
16
17
# File 'lib/coradoc/reference/materializer/base.rb', line 15

def kind
  nil
end

.presentationObject



19
20
21
# File 'lib/coradoc/reference/materializer/base.rb', line 19

def presentation
  :any
end

Instance Method Details

#materialize(edge:, result:, node:, presentation:, pages:) ⇒ CoreModel::Base?

Render one resolved edge.

Parameters:

Returns:

  • (CoreModel::Base, nil)

    replacement node, the original node to keep it, or nil to drop it from the tree

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/coradoc/reference/materializer/base.rb', line 38

def materialize(edge:, result:, node:, presentation:, pages:)
  raise NotImplementedError
end