Vow::Exportable::All
Inherits Vow::Mountable
include Vow::Exportable::All exports EVERY public method by default — no
per-method annotation required. @[Vow::Export(name:)] still renames a
method, and @[Vow::Export(skip: true)] (or simply making the method
private/protected) keeps one off the wire.
class API include Vow::Exportable::All
def greet(name : String) : String # auto-exported as "API.greet"
"Hello, #{name}!"
end
@[Vow::Export(name: "v1.add")] # auto-exported, renamed
def add(a : Int32, b : Int32) : Int32
a + b
end
private def secret : String # never exported
"nope"
end
end
Only "plain" public methods are picked up automatically: operators (+,
[]), setters (name=), predicate/bang methods (valid?, save!), and
Vow's own vow_* internals are skipped by default. Any of THOSE can still be
force-exported by annotating it with an explicit @[Vow::Export] (give it a
clean name: for a usable wire id).
initialize is different — it's a HARD block: a constructor can't be a
procedure, so it's never exported, and an explicit @[Vow::Export] on it is
a compile-time error rather than a silent no-op (a bare @[Vow::Export(skip: true)] is allowed but redundant). Class methods (def self.foo) are simply
invisible — the macro only ever inspects instance methods.
Because every exported signature must be fully typed (see the contract in
Generated), opting a class into All means committing to typed args and
an explicit return type on every public method — that's the price of a
trustworthy generated client.