Module.has_attribute-question-mark
You're seeing just the function
has_attribute-question-mark
, go back to Module module for more information.
Specs
Checks if the given attribute has been defined.
An attribute is defined if it has been registered with register_attribute/3
or assigned a value. If an attribute has been deleted with delete_attribute/2
it is no longer considered defined.
This function can only be used on modules that have not yet been compiled.
Examples
defmodule MyModule do
@value 1
Module.register_attribute(__MODULE__, :other_value)
Module.put_attribute(__MODULE__, :another_value, 1)
Module.has_attribute?(__MODULE__, :value) #=> true
Module.has_attribute?(__MODULE__, :other_value) #=> true
Module.has_attribute?(__MODULE__, :another_value) #=> true
Module.has_attribute?(__MODULE__, :undefined) #=> false
Module.delete_attribute(__MODULE__, :value)
Module.has_attribute?(__MODULE__, :value) #=> false
end