struct Noir::TreeSitterGoRouteExtractor::ScopedConfig

Overview

Chi-style extractor: walks the AST with a prefix stack so r.Route("/api", func(r chi.Router) { r.Get("/users", h) }) resolves to /api/users. Handles arbitrarily-nested .Route blocks plus .Group(func(r){ body }) (middleware group, no prefix change) and r.With(mw).Get(...) middleware chains (the verb receiver is any chain of .With(...) calls that bottoms out at an identifier).

skip_functions lets callers exclude function declarations whose body is analysed separately — e.g. chi.cr's analyze_router_function picks up adminRouter() under a Mount("/admin", adminRouter()), so re-emitting the same routes from the free-floating function body would duplicate them. Config for the scope-aware walker. Chi and gf share the same structural recognizer with different method names / extras.

Defined in:

miniparsers/go_route_extractor_ts.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(prefix_method : String = "Route", middleware_method : Nil | String = "Group", chain_prefix : Bool = false, bind_methods : Array(String) = [] of String, bind_method_verb : String = "ALL") #

[View source]

Instance Method Detail

def bind_method_verb : String #

[View source]
def bind_methods : Array(String) #

[View source]
def chain_prefix? : Bool #

[View source]
def middleware_method : String | Nil #

[View source]
def prefix_method : String #

[View source]