View Source Magma.Matter.Module (Magma v0.2.0)
Magma.Matter
type behaviour implementation for Elixir modules.
The Magma.Matter.Module
struct is used for generation of Magma.Artefact
s
about Elixir modules. It does not have any additional fields above the
Magma.Matter.fields/0
as it retrieves all necessary information via the
Elixir and Erlang reflection API from the module name.
Summary
Functions
Returns the list of Magma.Artefact
types available for Elixir modules.
Returns the source code of the module, if it exists.
Returns the name of the Magma.Concept
document for an Elixir module.
Returns the title header text of the Magma.Concept
document for an Elixir module.
Returns a list of the modules the given module
is defined under.
Returns a default description for the Magma.Concept
document of an Elixir module.
Determines whether the module should be ignored when generating documentation.
Creates a new Magma.Matter.Module
instance from a given module name in an ok tuple.
Creates a new Magma.Matter.Module
instance from a given module name and fails in error cases.
Returns the title for the description section of the module in artefact prompts.
Returns a string with a Markdown section containing the source code of the module for artefact prompts.
Returns the base path segment to be used for different kinds of documents for Elixir modules.
Returns the path for Magma.Concept
documents about Elixir modules.
Returns the source path of the module
, if it exists.
Returns a list of the submodules defined under the given module
.
Types
@type t() :: %Magma.Matter.Module{name: term()}
Functions
Returns the list of Magma.Artefact
types available for Elixir modules.
iex> Magma.Matter.Module.artefacts()
[Magma.Artefacts.ModuleDoc]
Returns the source code of the module, if it exists.
The source code is read from the source_path/1
.
Returns the name of the Magma.Concept
document for an Elixir module.
It is the module name as a string.
Example
iex> Some.Module ...> |> Magma.Matter.Module.new!() ...> |> Magma.Matter.Module.concept_name() "Some.Module"
Returns the title header text of the Magma.Concept
document for an Elixir module.
Example
iex> Some.Module
...> |> Magma.Matter.Module.new!()
...> |> Magma.Matter.Module.concept_title()
"Some.Module
"
Returns a list of the modules the given module
is defined under.
Example
iex> Magma.Matter.Module.context_modules(Magma.DocumentStruct.Section)
[Magma, Magma.DocumentStruct]
Returns a default description for the Magma.Concept
document of an Elixir module.
Determines whether the module should be ignored when generating documentation.
A module is ignored
- if it has a # Magma pragma: ignore comment at the beginning of its source code, or
- if it is marked as hidden (e.g. with
@moduledoc false
) and does not have aMagma pragma: include comment at the beginning of its source code.
Creates a new Magma.Matter.Module
instance from a given module name in an ok tuple.
Creates a new Magma.Matter.Module
instance from a given module name and fails in error cases.
Returns the title for the description section of the module in artefact prompts.
Example
iex> Some.Module
...> |> Magma.Matter.Module.new!()
...> |> Magma.Matter.Module.prompt_concept_description_title()
"Description of the module `Some.Module`"
Returns a string with a Markdown section containing the source code of the module for artefact prompts.
Returns the base path segment to be used for different kinds of documents for Elixir modules.
The base path for all modules is "modules"
.
Returns the path for Magma.Concept
documents about Elixir modules.
Example
iex> Some.Module
...> |> Magma.Matter.Module.new!()
...> |> Magma.Matter.Module.relative_concept_path()
"modules/Some/Some.Module.md"
Returns the source path of the module
, if it exists.
The source path is the file path where the source code of the module is located.
Returns a list of the submodules defined under the given module
.
Note: This function relies on the existence of concept documents for modules.