Consider this snippet from Programming Phoenix:
defmodule Rumbl.VideoController do
use Rumbl.Web, :controller
def index(conn, _params) do
videos = Repo.all(Video)
render(conn, "index.html", videos: videos)
end
end
index
uses the render
function, which it got from an import triggered by use Rumbl.Web, :controller
.
I know that other functions were imported also. But does Elixir provide a way to list them?
Can I list available functions for the current scope in Elixir?
You can get such information from __ENV__
macro. Documentation is present for Macro.Env
struct it returns.
The most interesting fields from that struct for you would be functions
and macros
that contain a list of currently available functions and macros together with the module they originated from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With