Wayfinder.Processor.Introspect (Wayfinder v0.1.0)

View Source

Extracts {line, file} metadata for a given controller and action.

Used to emit @see references for frontend route/action generators.

Summary

Functions

Returns the {line, file} where the given controller module and action are defined.

Types

location()

@type location() :: {line :: pos_integer(), file :: binary()} | nil

Functions

source_location(module, function_name)

@spec source_location(module(), atom()) :: location()

Returns the {line, file} where the given controller module and action are defined.

Returns nil if not available.

Example

iex> source_location(MyAppWeb.PostController, :index)
{15, "/app/lib/my_app_web/controllers/post_controller.ex"}