Class: Ucode::Repo::Writers::PlanesWriter

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

Overview

Writes output/planes/<n>.json for every plane (0..16).

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:, blocks:) ⇒ PlanesWriter

Returns a new instance of PlanesWriter.

Parameters:



41
42
43
44
# File 'lib/ucode/repo/writers/planes_writer.rb', line 41

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

Instance Method Details

#writeInteger

Returns number of plane files written (always 17 when the directory is reachable; one per plane number).

Returns:

  • (Integer)

    number of plane files written (always 17 when the directory is reachable; one per plane number)



48
49
50
51
52
53
54
55
56
# File 'lib/ucode/repo/writers/planes_writer.rb', line 48

def write
  plane_block_ids = group_block_ids_by_plane
  count = 0
  (0..16).each do |n|
    path = Paths.(@output_root, n)
    count += 1 if write_atomic(path, plane_payload(n, plane_block_ids[n] || []))
  end
  count
end