struct
UI::App::ScreenRegistration
- UI::App::ScreenRegistration
- Struct
- Value
- Object
Overview
A single registered screen. The dispatcher looks one up by
#route_id to find which controller to construct + which screen
class to render.
Phase 8C extensions (additive — Phase 8B callers still work):
#controller_classis now nilable. A web-only screen (no native UI::Controller wired) registers withcontroller_class: nil.UI::ActionDispatcher#dispatchraisesWebOnlyScreenErrorif it ever resolves a route to such a registration.#screen_classis now nilable. A web-only screen need not supply aUI::Screensubclass — the native dispatch path that would consume it is already guarded by the same web-only error.web_controllercarries anAmber::Controller::Basesubclass when the screen contributes web routes. Distinct from#controller_classbecause the web and native controller hierarchies do not unify in Phase 8C (Phase 8A's parallel architecture). Typed asClass?since Amber may not be loaded when the asset_pipeline shard is compiled standalone.#web_pathis the route prefix used byroutes_forto fill in any action whose entry omitspath:.#web_actionsis the array of NamedTuple-literal entries{verb: Symbol, action: Symbol, path: String?}driving the emitted Amber router calls. Kept as a NamedTuple-literal array (not a Record) because Crystal's macro engine can walk NamedTuple literals field-by-field; Record-construction Calls would require Call.named_args AST extraction (Codex finding #4 incodex-critique-1-brief-8c.md). Note onweb_controller_name : String?:
Crystal disallows Class in union types ("can't use Class in
unions yet") AND Class cannot be used as an instance-variable
type. The asset_pipeline shard also cannot require Amber (Amber
is a peer dependency, not a transitive one), so we cannot type
the field as Amber::Controller::Base.class | Nil.
The pragmatic compromise: store the web controller's class NAME
as a String? for introspection (so tests / runtime tooling can
inspect "which Amber controller does this screen bind to?"), and
interpolate the actual class reference DIRECTLY into the macro
expansion in routes_for (which has the literal class AST node
frozen in at outer-screen-macro expansion time). The class ref
therefore never needs to be stored at runtime; it lives only in
the compile-time macro body.
#has_web? is True iff #web_actions is non-empty (post-default).
Defined in:
asset_pipeline/native_app.crConstructors
Instance Method Summary
- #clone
- #controller_class : UI::Controller.class | Nil
- #copy_with(route_id _route_id = @route_id, controller_class _controller_class = @controller_class, screen_class _screen_class = @screen_class, web_controller_name _web_controller_name = @web_controller_name, web_path _web_path = @web_path, web_actions _web_actions = @web_actions)
-
#has_web? : Bool
True iff this registration contributes any Amber web routes.
- #route_id : Symbol
- #screen_class : UI::Screen.class | Nil
- #web_actions : Array(NamedTuple(verb: Symbol, action: Symbol, path: String | Nil))
- #web_controller_name : String | Nil
- #web_path : String | Nil