Module.register_attribute

You're seeing just the function register_attribute, go back to Module module for more information.
Link to this function

register_attribute(module, attribute, options)

View Source

Specs

register_attribute(module(), atom(), accumulate: boolean(), persist: boolean()) ::
  :ok

Registers an attribute.

By registering an attribute, a developer is able to customize how Elixir will store and accumulate the attribute values.

Options

When registering an attribute, two options can be given:

  • :accumulate - several calls to the same attribute will accumulate instead of overriding the previous one. New attributes are always added to the top of the accumulated list.

  • :persist - the attribute will be persisted in the Erlang Abstract Format. Useful when interfacing with Erlang libraries.

By default, both options are false.

Examples

defmodule MyModule do
  Module.register_attribute(__MODULE__, :custom_threshold_for_lib, accumulate: true)

  @custom_threshold_for_lib 10
  @custom_threshold_for_lib 20
  @custom_threshold_for_lib #=> [20, 10]
end