Skip to content

Commit 2cee595

Browse files
committed
Merge pull request #4121 from jisaacstone/master
documenting the default return value for `Module.get_attribute/2`
2 parents 08a19d0 + b781325 commit 2cee595

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

lib/elixir/lib/module.ex

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,10 @@ defmodule Module do
489489
end
490490

491491
@doc """
492-
Concatenates a list of aliases and returns a new alias only
493-
if the alias was already referenced. If the alias was not
494-
referenced yet, fails with `ArgumentError`.
492+
Concatenates a list of aliases and returns a new alias only if the alias
493+
was already referenced.
494+
495+
If the alias was not referenced yet, fails with `ArgumentError`.
495496
It handles char lists, binaries and atoms.
496497
497498
## Examples
@@ -509,9 +510,10 @@ defmodule Module do
509510
end
510511

511512
@doc """
512-
Concatenates two aliases and returns a new alias only
513-
if the alias was already referenced. If the alias was not
514-
referenced yet, fails with `ArgumentError`.
513+
Concatenates two aliases and returns a new alias only if the alias was
514+
already referenced.
515+
516+
If the alias was not referenced yet, fails with `ArgumentError`.
515517
It handles char lists, binaries and atoms.
516518
517519
## Examples
@@ -529,9 +531,10 @@ defmodule Module do
529531
end
530532

531533
@doc """
532-
Attaches documentation to a given function or type. It expects
533-
the module the function/type belongs to, the line (a non negative
534-
integer), the kind (`def` or `defmacro`), a tuple representing
534+
Attaches documentation to a given function or type.
535+
536+
It expects the module the function/type belongs to, the line (a non
537+
negative integer), the kind (`def` or `defmacro`), a tuple representing
535538
the function and its arity, the function signature (the signature
536539
should be omitted for types) and the documentation, which should
537540
be either a binary or a boolean.
@@ -683,6 +686,7 @@ defmodule Module do
683686

684687
@doc """
685688
Checks if the module defines the given function or macro.
689+
686690
Use `defines?/3` to assert for a specific type.
687691
688692
## Examples
@@ -702,8 +706,9 @@ defmodule Module do
702706

703707
@doc """
704708
Checks if the module defines a function or macro of the
705-
given `kind`. `kind` can be any of `:def`, `:defp`,
706-
`:defmacro` or `:defmacrop`.
709+
given `kind`.
710+
711+
`kind` can be any of `:def`, `:defp`, `:defmacro` or `:defmacrop`.
707712
708713
## Examples
709714
@@ -761,6 +766,7 @@ defmodule Module do
761766

762767
@doc """
763768
Makes the given functions in `module` overridable.
769+
764770
An overridable function is lazily defined, allowing a
765771
developer to customize it. See `Kernel.defoverridable/1` for
766772
more information and documentation.
@@ -802,7 +808,9 @@ defmodule Module do
802808

803809
@doc """
804810
Puts an Erlang attribute to the given module with the given
805-
key and value. The semantics of putting the attribute depends
811+
key and value.
812+
813+
The semantics of putting the attribute depends
806814
if the attribute was registered or not via `register_attribute/3`.
807815
808816
## Examples
@@ -838,9 +846,12 @@ defmodule Module do
838846
end
839847

840848
@doc """
841-
Gets the given attribute from a module. If the attribute
842-
was marked with `accumulate` with `Module.register_attribute/3`,
843-
a list is always returned.
849+
Gets the given attribute from a module.
850+
851+
If the attribute was marked with `accumulate` with
852+
`Module.register_attribute/3`, a list is always returned. `nil` is returned
853+
if the attribute has not been marked with `accumulate` and has not been set
854+
to any value.
844855
845856
The `@` macro compiles to a call to this function. For example,
846857
the following code:

0 commit comments

Comments
 (0)