class
Analyzer::Crystal::Kemal
Defined in:
analyzer/analyzers/crystal/kemal.crConstant Summary
-
MACRO_VAR_PATTERN =
/\{\{\s*(\w+)\s*=\s*([A-Za-z_][\w:]*)\s*\}\}/ -
Compile-time macro var assignment, e.g.
{{namespace = Routes::API::V1}}. invidious sets it once, then registers 50+ routes asget "/…", {{namespace}}::Videos, :videos— substituting it back lets those routes resolve their controller and carry callees. -
MOUNT_PATTERN =
/^\s*mount\s+["'](.+?)["']\s*,\s*(\w+)/ -
NAMESPACE_PATTERN =
/^(\s*)(?:(\w+)\.)?namespace\s+["'](.+?)["']/ -
ROUTER_PATTERN =
/^\s*(\w+)\s*=\s*Kemal::Router\.new/ -
SERVE_STATIC_DISABLED_RE =
Regex.union("serve_static false", "serve_static(false)") -
serve_static false/serve_static(false)— checked on every source line, so the two fixed OR-edString#includes?substring scans are precompiled into a single regex union (one PCRE2 JIT scan per line instead of two naive substring scans).
Instance Method Summary
- #analyze
- #analyze_file(path : String) : Array(Endpoint)
- #line_to_endpoint(content : String) : Endpoint
- #line_to_param(content : String) : Param