Class: Textus::Application::Writes::Publish
- Inherits:
-
Object
- Object
- Textus::Application::Writes::Publish
- Defined in:
- lib/textus/application/writes/publish.rb
Overview
Single-pass publish use case: dispatches polymorphically to each entry’s ‘publish_via` method. Derived entries materialize their body via Materializer; Nested entries fan out via publish_each; Leaf and Intake entries copy their stored body to publish_to targets. The Publish layer owns wiring (context, accumulation) but not per-kind logic.
Return shape: { “protocol”, “built”, “published_leaves” }
Instance Method Summary collapse
- #call(prefix: nil) ⇒ Object
-
#initialize(ctx:, manifest:, file_store:, bus:, root:, store:, hook_context:) ⇒ Publish
constructor
rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(ctx:, manifest:, file_store:, bus:, root:, store:, hook_context:) ⇒ Publish
rubocop:disable Metrics/ParameterLists
13 14 15 16 17 18 19 20 21 |
# File 'lib/textus/application/writes/publish.rb', line 13 def initialize(ctx:, manifest:, file_store:, bus:, root:, store:, hook_context:) # rubocop:disable Metrics/ParameterLists @ctx = ctx @manifest = manifest @file_store = file_store @bus = bus @root = root @store = store @hook_context = hook_context end |
Instance Method Details
#call(prefix: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/textus/application/writes/publish.rb', line 23 def call(prefix: nil) built = [] leaves = [] context = build_context @manifest.entries.each do |mentry| next if prefix && !entry_matches_prefix?(mentry, prefix) result = mentry.publish_via(context, prefix: prefix) next if result.nil? case result[:kind] when :built then built << result[:value] when :leaves then leaves.concat(result[:value]) end end { "protocol" => Textus::PROTOCOL, "built" => built, "published_leaves" => leaves } end |