struct UI::App::ScreenRegistration

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):

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(route_id : Symbol, controller_class : UI::Controller.class | Nil, screen_class : UI::Screen.class | Nil, web_controller_name : String | Nil = nil, web_path : String | Nil = nil, web_actions : Array(NamedTuple(verb: Symbol, action: Symbol, path: String | Nil)) = [] of NamedTuple(verb: Symbol, action: Symbol, path: String | ::Nil)) #

[View source]

Instance Method Detail

def clone #

[View source]
def controller_class : UI::Controller.class | Nil #

def 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) #

[View source]
def has_web? : Bool #

True iff this registration contributes any Amber web routes.


[View source]
def route_id : Symbol #

def screen_class : UI::Screen.class | Nil #

def web_actions : Array(NamedTuple(verb: Symbol, action: Symbol, path: String | Nil)) #

def web_controller_name : String | Nil #

def web_path : String | Nil #