module

Vow

Vow — annotate your methods, Vow generates the dispatch glue.

Annotate instance methods with @[Vow::Export], include Vow::Exportable (or include Vow::Exportable::All to export every public method), and the compiler generates an install(registry) that registers each as a typed, JSON-in/JSON-out procedure. Transports (HTTP, CLI, …) sit on Vow::Registry#dispatch and stay out of the codegen.

class API include Vow::Exportable

@[Vow::Export]
def greet(name : String) : String
  "Hello, #{name}!"
end

end

registry = Vow::Registry.new(API.new) registry.dispatch("API.greet", %(["world"])) # => %("Hello, world!")

Constants

MANIFEST_BEGIN = "<<<VOW_MANIFEST"

Markers framing the manifest JSON on stdout, so vow gen --entry can lift it out cleanly even if the program writes other things at startup.

MANIFEST_END = "VOW_MANIFEST>>>"
MANIFEST_FLAG = "--vow-emit-manifest"

The flag that turns any Vow program into a manifest emitter. vow gen --entry compiles the user's annotated program and runs it with this — the user writes no dump code; the @[Vow::Export] annotations are the input.

VERSION = {{ (`shards version \"/tmp/tmp.CnnFmj/src/src\"`).chomp.stringify }}

Class methods

discovered_manifest

The manifest for EVERY Vow service in the compiled program, built at the end of compilation straight from the statically-captured descriptors — no instances, no registry, no user code. Both mixins route through Vow::Exportable::Generated, so its includers are exactly the services to gather (annotated or export-all alike).

Source
emit_manifest(io : IO = STDOUT) : Nil

Writes the discovered manifest to io, framed by the markers. Raises Vow::Error when nothing is annotated — Vow never emits an empty client. Pure and testable: no exit, no ARGV.

Source
maybe_emit_manifest(argv : Array(String) = ARGV) : Nil

Auto-installed below: under --vow-emit-manifest, emit the manifest and exit before any user code runs; otherwise do nothing. A thin exit wrapper around emit_manifest, kept separate so the emit logic stays testable.

Source

Nested types