class

AnalyzerExample

Inherits FileScanEngine < Analyzer < FileHelper < Reference < Object

Template for a new framework adapter (layer L2).

Copy this file to src/analyzer/analyzers/{language}/{framework}.cr, rename the class, and point it at your language's engine. See AGENTS.md §"Analyzer Layering" and docs/content/development/analyzer_architecture/ for the full walkthrough.

The three layers, and which one this file is:

L0 Language Engine src/analyzer/engines/{lang}_engine.cr Owns the file set and the walk. Inherit it. L1 Route Extractor src/miniparsers/{lang}_route_extractor*.cr Owns parsing. Call it. L2 Framework Adapter THIS FILE Owns framework-specific route/param rules.

Rule: an adapter receives routes. It does not walk the filesystem and it does not parse tokens. If you find yourself reaching for Dir.glob, File.open or each_line here, the work belongs in L0 or L1 instead.

AnalyzerExample deliberately sits outside the Analyzer:: namespace so the registry sweep in initialize_analyzers skips it — which is also why it carries no analyzer_for. Your real analyzer needs both.

Instance methods

analyze_file(path : String) : Array(Endpoint)

Shape A — per-file extraction.

FileScanEngine#analyze drives the walk and concatenates whatever each call returns. Use this shape unless you need state that spans files.

Source