class

Analyzer::Crystal::Grip

Inherits Analyzer::Crystal::CrystalEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object

Constants

GRIP_ROUTE_RE = /(?:^|[^.\w])(get|post|put|patch|delete|options|head)\s+['"](.+?)['"]/

One combined PCRE2 scan replaces the previous 7 sequential per-verb matchers. Grip requires whitespace after the verb (get "/x", not get("/x")) — the \s+ keeps that shape, so input "/x" still cannot be read as put "/x".

SCOPE_END_RE = /^(\s*)end\b/
SCOPE_OPEN_RE = /^(\s*)scope\s+['"](.+?)['"].*\bdo\b/
WS_ROUTE_RE = /(?:^|[^.\w])ws\s+['"](.+?)['"]/

Class methods

tech_name
Source

Instance methods

analyze_file(path : String) : Array(Endpoint)
Source
line_to_endpoint(content : String, scopes : Array(String)) : Endpoint
Source
line_to_param(content : String) : Param
Source
line_to_websocket(content : String, scopes : Array(String)) : Endpoint
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source