Class: Textus::Write::Materializer

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/write/materializer.rb

Overview

Materializes a single projection-derived manifest entry onto disk by running the builder pipeline (projection + template render). External entries are NOT materialized here — they are generated by an out-of-band runner and only staleness-tracked, so Derived#publish_via filters them out before reaching this point. Extracted from Write::Build so that Publish can reuse it without creating a Build dependency.

Instance Method Summary collapse

Constructor Details

#initialize(container:, call:) ⇒ Materializer

Returns a new instance of Materializer.



13
14
15
16
17
18
19
20
# File 'lib/textus/write/materializer.rb', line 13

def initialize(container:, call:)
  @container  = container
  @call       = call
  @manifest   = container.manifest
  @file_store = container.file_store
  @rpc        = container.rpc
  @root       = container.root
end

Instance Method Details

#run(mentry) ⇒ Object

Runs the builder pipeline for ‘mentry` and returns the on-disk target_path string.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/textus/write/materializer.rb', line 24

def run(mentry)
  reader = Textus::Read::Get.new(container: @container, call: @call)
  lister = Textus::Read::List.new(container: @container)
  Builder::Pipeline.run(
    mentry: mentry,
    deps: Builder::Pipeline::Deps.new(
      manifest: @manifest,
      reader: reader.method(:call),
      lister: lister.method(:call),
      rpc: @rpc,
      template_loader: ->(name) { read_template(name) },
      transform_context: @container,
      inject_boot: -> { Textus::Boot.build(container: @container) },
    ),
  )
end