Reputation: 4676
In elixir we have the Pseudo-variables __MODULE__
, __DIR__
et al. In erlang there is also the functionality to get the current line, using an erlang macro.
How do I get the current file line in elixir.
Something like
IO.puts __LINE__
Upvotes: 4
Views: 1523
Reputation: 54714
It's all inside __ENV__
:
IO.puts __ENV__.file
IO.puts __ENV__.line
Also see https://hexdocs.pm/elixir/Macro.Env.html
Upvotes: 6