Add simple annotations to elixir methods which can be used later to do some funkiness see https://medium.com/@cowen/annotations-in-elixir-450015ecdd97
defmodule Example do
use Annotatable, [:bar, :foo]
@bar true
def bar_method do end
@foo [:test]
@bar true
def foo_bar_method do end
def no_annotation_method do end
@baz "ads"
def undefined_annotation_method do end
end
And later:
Example.annotations
Gives:
%{
bar_method: [%{annotation: :bar, value: true}],
foo_bar_method: [
%{annotation: :bar, value: true},
%{annotation: :foo, value: [:test]}
]
}
If available in Hex, the package can be installed as:
- Add
annotatable
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:annotatable, "~> 0.1.0"}]
end
```
- Ensure
annotatable
is started before your application:
```elixir
def application do
[applications: [:annotatable]]
end
```