class

Analyzer::Cfml::Wheels

Inherits Analyzer::Cfml::CfmlEngine < Analyzer < FileHelper < Reference < Object

Wheels routing.

Routes are one fluent chain in config/routes.cfm:

mapper()
    .get(name="login", pattern="login", to="sessions##new")
    .resources("users")
    .scope(path="admin", package="admin")
        .resources(name="users", nested=true)
            .member()
                .post("assume")
            .end()
        .end()
    .end()
    .root(to="tweets##index", method="get")
.end();

The chain is order-dependent, so it is walked sequentially with a prefix stack: scope, namespace, a nested resources and member each push a path segment, and end() pops it. Without that, every admin route would be emitted at the top level.

Constants

DSL_CALL_RE = /\.\s*([A-Za-z_]\w*)\s*\(/
KEY_SEGMENT = "[key]"

Default key segment for a member route.

MAPPER_RE = /(?<![\w.])mapper\s*\(/i
PLACEHOLDER_RE = /\[([A-Za-z_]\w*)\]/

Wheels writes path variables in brackets, not colons.

RESOURCE_ROUTES = [{"new", ["GET"], "/new"}, {"create", ["POST"], ""}, {"show", ["GET"], ""}, {"edit", ["GET"], "/edit"}, {"update", ["PUT", "PATCH"], ""}, {"delete", ["DELETE"], ""}]

Singular resource has no index and no key segment — it always acts on the one record implied by the session.

RESOURCES_ROUTES = [{"index", ["GET"], ""}, {"new", ["GET"], "/new"}, {"create", ["POST"], ""}, {"show", ["GET"], "/[key]"}, {"edit", ["GET"], "/[key]/edit"}, {"update", ["PUT", "PATCH"], "/[key]"}, {"delete", ["DELETE"], "/[key]"}]

Wheels' plural resource set. update answers both PUT and PATCH.

ROUTES_FILE = "routes.cfm"
VERB_CALLS = Set {"get", "post", "put", "patch", "delete", "head", "options"}

Class methods

tech_name
Source

Instance methods

analyze
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