Class: Kumi::SchemaMetadata::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/kumi/schema_metadata/printer.rb

Overview

Renders Kumi::SchemaMetadata as a compact, readable report — the algebra of the schema in one screen. Designed to be dropped into an LLM prompt: every input’s type/domain/shape, every definition’s expression and dependencies, and the evaluation order, with no source file required.

INPUTS (free variables)
  age              : integer  in 18..99
  income           : float
  items[].qty      : integer  in 1..100      (axis: items)
  items[].price    : float                   (axis: items)

DEFINITIONS (value/trait := expression)
  adult     trait  boolean          := (input.age >= 18)
  line      value  float   [items]  := (input.items.item.qty * input.items.item.price)
  subtotal  value  float            := sum(line)        reads: line

EVALUATION ORDER
  line -> subtotal -> adult -> wealthy -> tier

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ Printer

Returns a new instance of Printer.



24
25
26
# File 'lib/kumi/schema_metadata/printer.rb', line 24

def initialize()
  @md = 
end

Instance Method Details

#renderObject



28
29
30
31
32
# File 'lib/kumi/schema_metadata/printer.rb', line 28

def render
  sections = [legend, inputs_section, definitions_section, order_section]
  sections << imports_section unless @md.imported_names.empty?
  sections.compact.join("\n\n")
end