Module meta

Data Types

meta_abs_function()

meta_abs_function() = forms:form()

meta_abs_record()

meta_abs_record() = forms:form()

meta_abs_spec()

meta_abs_spec() = forms:form()

meta_abs_type()

meta_abs_type() = forms:form()

meta_module()

meta_module() = module() | forms:forms()

meta_opt()

meta_opt() = force | permanent

meta_opts()

meta_opts() = [meta_opt()]

meta_type()

meta_type() = atom() | {record, atom()}

Function Index

add_forms/2 Add the provided forms at the end of the specified module.
add_forms/3
add_function/3 Adds the provided function to the given module.
add_function/4
apply_changes/1 Replace the specified modules implementation by the binary resulting of compiling the provided forms.
apply_changes/2
apply_changes/3
behaviours/1 Get a list featuring the name of all the behaviours used by the provided module.
callbacks/1 Get a list featuring the name and arity of all the callbacks defined in the provided module.
calling_functions/3 Get a list of all the functions with static calls to the provided function.
export_function/3 Add the function Name/Arity to the list of exported functions.
function/3 Fetch the abstract code of the requested function from the given module.
function/4
functions/1 Get a list featuring the name and arity of all the functions defined in the provided module.
has_attr/2 Check if the given module has the specified attribute.
has_function/3 Check if the specified function exists in the provided module.
has_record/2 Check if the specified record exists in the provided module.
has_spec/3 Check if the specified function specification exists in the provided module.
has_type/3 Check if the specified type exists in the provided module.
is_function_exported/3 Check if the provided function is exported by the given module.
is_type_exported/2 Check if the provided type is exported by the given module.
module_name/1 Given the forms of a module, return its name.
record/2 Fetch the abstract code of the specified record.
record/3
records/1 Get a list featuring the name of all the records defined in the provided module.
rename_function/5
rename_function/6 Rename the specified function.
replace_function/4
replace_function/5 Replace the specified function by the provided function.
rm_function/4
rm_function/5 Remove the specified function for the provided module.
rm_spec/3
rm_spec/4 Remove the function specification for the provided function, if any.
spec/3 Fetch the abstract code of the requested function specification from the given module.
spec/4
specs/1 Get a list featuring the name and arity of all the function specifications defined in the provided module.
type/3 Fetch the abstract code of the specified type.
type/4
types/1 Get a list featuring the name and arity of all the types defined in the provided module.
unexport_function/3
unexport_function/4 Remove the function Name/Arity from the list of exported functions.

Function Details

add_forms/2

add_forms(Forms, Module) -> any()

Add the provided forms at the end of the specified module.

add_forms/3

add_forms(Forms, Module, Opts) -> any()

add_function/3

add_function(Function::meta_abs_function(), Export::boolean(), Module::forms:forms()) -> meta_module()

Adds the provided function to the given module. If the exportet flag is set to true, the function will feature in the list of exported functions.

When specifying a module name instead of a modules' forms, these are the options one can set: force and permanent. When 'force' is used, this function will modify modules even if they are in a sticky directory. force - Modifies the module, even if it is located in a sticky directory permanent - The change will persist even after a node restart

add_function/4

add_function(Function::meta_abs_function(), Exp::boolean(), Mod::module(), Opts::meta_opts()) -> meta_module()

apply_changes/1

apply_changes(Forms::forms:forms()) -> meta_module()

Replace the specified modules implementation by the binary resulting of compiling the provided forms.

This function accepts two options, which have to do with whether changes to a module's AST should be transient or permanent, and whether the AST of protected modules can be modified, or not. By default, changes are transient (i.e., they do not survive a node restart) and cannot be applied to protected modules. If one wants to change this behaviour, one has to set the 'permanent' and/or 'force' options, respectively.

When changes are set to be permanent, this function returns the name of the module the changes have been applied to. When changes are transient, this function returns the AST of the module, so that one can keep on manipulating it.

apply_changes/2

apply_changes(Forms::forms:forms(), Opts::meta_opts()) -> meta_module()

apply_changes/3

apply_changes(Module::module(), Forms::forms:forms(), Opts::meta_opts()) -> meta_module()

behaviours/1

behaviours(Module::meta_module()) -> list()

Get a list featuring the name of all the behaviours used by the provided module.

callbacks/1

callbacks(Module::meta_module()) -> list()

Get a list featuring the name and arity of all the callbacks defined in the provided module.

calling_functions/3

calling_functions(Name::atom(), Arity::integer(), Mod::meta_module()) -> list()

Get a list of all the functions with static calls to the provided function.

export_function/3

export_function(Name::atom(), Arity::integer(), Module::meta_module()) -> meta_module()

Add the function Name/Arity to the list of exported functions.

function/3

function(Name::atom(), Arity::integer(), Module::meta_module()) -> {meta_abs_function(), undefined | meta_abs_spec(), list()}

Fetch the abstract code of the requested function from the given module.

Note that a function might depend on other forms such as records and type and function specifications.

If the function is not found, it throws a '{function_not_found, {Name, Arity}}' exception.

function/4

function(Name::atom(), Arity::integer(), Module::meta_module(), Opts::list()) -> {meta_abs_function(), undefined | meta_abs_spec(), list()}

functions/1

functions(Module::meta_module()) -> list()

Get a list featuring the name and arity of all the functions defined in the provided module.

has_attr/2

has_attr(Name::atom(), Module::meta_module()) -> boolean()

Check if the given module has the specified attribute.

has_function/3

has_function(Name::atom(), Arity::arity(), Module::meta_module()) -> boolean()

Check if the specified function exists in the provided module.

has_record/2

has_record(Name::atom(), Module::meta_module()) -> boolean()

Check if the specified record exists in the provided module.

has_spec/3

has_spec(Name::atom(), Arity::arity(), Module::meta_module()) -> boolean()

Check if the specified function specification exists in the provided module.

has_type/3

has_type(Name::meta_type(), Arity::arity(), Module::meta_module()) -> boolean()

Check if the specified type exists in the provided module.

is_function_exported/3

is_function_exported(Name::atom(), Arity::arity(), Module::meta_module()) -> boolean()

Check if the provided function is exported by the given module.

is_type_exported/2

is_type_exported(Type::{atom(), integer()}, Module::meta_module()) -> boolean()

Check if the provided type is exported by the given module.

module_name/1

module_name(Forms::forms:forms()) -> atom()

Given the forms of a module, return its name.

record/2

record(Name::atom(), Module::meta_module()) -> {meta_abs_record(), meta_abs_type(), list(), list()}

Fetch the abstract code of the specified record.

record/3

record(Name, Module, Opts) -> any()

records/1

records(Module::meta_module()) -> list()

Get a list featuring the name of all the records defined in the provided module.

rename_function/5

rename_function(Name::atom(), Arity::arity(), NewName::atom(), RenameAll::boolean(), Module::meta_module()) -> forms:forms()

rename_function/6

rename_function(Name::atom(), Arity::arity(), NewName::atom(), RenameAll::boolean(), Module::meta_module(), Opts::meta_opts()) -> meta_module()

Rename the specified function.

If set to true, all references to the renamed function (e.g., function specifications, (static) function calls, etc.) will also be updated.

replace_function/4

replace_function(Name::atom(), Arity::integer(), Function::meta_abs_function(), Module::meta_module()) -> meta_module()

replace_function/5

replace_function(Name::atom(), Arity::integer(), Function::meta_abs_function(), Module::meta_module(), Opts::meta_opts()) -> meta_module()

Replace the specified function by the provided function.

A wrong_arity exception is thrown if the artity of the provided function does not match the specified arity.

rm_function/4

rm_function(F::atom(), A::integer(), RmAll::boolean(), Module::meta_module()) -> forms:forms()

rm_function/5

rm_function(F::atom(), A::integer(), RmAll::boolean(), Module::module(), Opts::meta_opts()) -> forms:forms()

Remove the specified function for the provided module.

If the third argument is set to true, all functions calling the specified function will also be removed.

When specifying a module name instead of a modules' forms, these are the options one can set: force and binary. When 'force' is used, this function will modify modules even if they are in a sticky directory. force - Modifies the module, even if it is located in a sticky directory permanent - The change will persist even after a node restart

rm_spec/3

rm_spec(F1::atom(), A1::integer(), Forms::forms:forms()) -> forms:forms()

rm_spec/4

rm_spec(F::atom(), A::integer(), Mod::module(), Opts::meta_opts()) -> meta_module()

Remove the function specification for the provided function, if any.

When specifying a module name instead of a modules' forms, these are the options one can set: force and binary. When 'force' is used, this function will modify modules even if they are in a sticky directory. force - Modifies the module, even if it is located in a sticky directory permanent - The change will persist even after a node restart

spec/3

spec(Name::atom(), Arity::arity(), Module::meta_module()) -> {meta_abs_spec(), list(), list()} | no_return()

Fetch the abstract code of the requested function specification from the given module.

If the function specification is not found, a {spec_not_found, {Name, Arity}} exception is thrown.

spec/4

spec(Name::atom(), Arity::arity(), Module::meta_module(), Opts::list()) -> {meta_abs_spec(), list(), list()} | no_return()

specs/1

specs(Module::meta_module()) -> list()

Get a list featuring the name and arity of all the function specifications defined in the provided module.

type/3

type(Name::atom(), Arity::arity(), Module::meta_module()) -> {meta_abs_type(), list()}

Fetch the abstract code of the specified type.

type/4

type(Name::atom(), Arity::arity(), Module::meta_module(), Opts::list()) -> {meta_abs_type(), list()}

types/1

types(Module::meta_module()) -> list()

Get a list featuring the name and arity of all the types defined in the provided module.

unexport_function/3

unexport_function(Name::atom(), Arity::integer(), Module::forms:forms()) -> meta_module()

unexport_function/4

unexport_function(Name::atom(), Arity::integer(), Mod::module(), Opts::meta_opts()) -> meta_module()

Remove the function Name/Arity from the list of exported functions.

When specifying a module name instead of a modules' forms, these are the options one can set: force and binary. When 'force' is used, this function will modify modules even if they are in a sticky directory. force - Modifies the module, even if it is located in a sticky directory permanent - The change will persist even after a node restart


Generated by EDoc