Analyzer::Javascript::Restify
Inherits Analyzer::Javascript::JavascriptEngine < Analyzer < FileHelper < Reference < Object
Constants
CLIENT_LIBRARY_RE = Regex.union("restify-clients", "createJSONClient(", "createStringClient(", "createHttpClient(")
Precompiled once — a single PCRE2-JIT scan replaces four naive String#includes? substring scans over the whole file content. Regex.union auto-escapes each literal, so this is provably equivalent to the OR-of-includes? it replaces.
DOT_METHOD_RES = HTTP_METHOD_KEYS.map do |m| {m, /\.\s*#{m}\s*\(\s*['"]([^'"]+)['"]/} end.to_h
HTTP_METHOD_KEYS = ["get", "post", "put", "delete", "patch", "options", "head", "del"] of ::String
ROUTER_NAME_METHOD_RES = HTTP_METHOD_KEYS.map do |m| {m, /\b(?:\w+Router)\s*\.\s*#{m}\s*\(\s*['"]([^'"]+)['"]/} end.to_h
Compiled once — interpolated regex literals would otherwise be rebuilt (full PCRE2 compile) for every method on every line.
VERSIONED_PATH_RES = HTTP_METHOD_KEYS.map do |m| {m, /\.#{m}\s*\(\s*\{\s*path\s*:\s*['"]([^'"]+)['"]/} end.to_h
Class methods
tech_name
SourceInstance methods
analyze
Sourcetech
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.