Class: Ucode::Repo::Writers::RelationshipsWriter

Inherits:
Object
  • Object
show all
Includes:
AtomicWrites
Defined in:
lib/ucode/repo/writers/relationships_writer.rb

Overview

Writes one file per relationship table under output/relationships/. The set of tables is enumerated by Coordinator::Indices#each_relationship (see Candidate 1 of the 2026-06-29 review).

One of the eight per-concern writers split out from AggregateWriter — see Candidate 5 of the 2026-06-29 review.

Instance Method Summary collapse

Methods included from AtomicWrites

#same_content?, #to_pretty_json, #write_atomic

Constructor Details

#initialize(output_root:, indices:) ⇒ RelationshipsWriter

Returns a new instance of RelationshipsWriter.

Parameters:



23
24
25
26
# File 'lib/ucode/repo/writers/relationships_writer.rb', line 23

def initialize(output_root:, indices:)
  @output_root = output_root
  @indices = indices
end

Instance Method Details

#writeInteger

Returns number of relationship files written.

Returns:

  • (Integer)

    number of relationship files written



29
30
31
32
33
# File 'lib/ucode/repo/writers/relationships_writer.rb', line 29

def write
  @indices.each_relationship.sum do |slug, records|
    write_relationship_file(slug, records)
  end
end