Add docs on guards
This commit is contained in:
parent
ca724d0300
commit
bb62e631f3
2 changed files with 14 additions and 0 deletions
|
@ -1,7 +1,17 @@
|
|||
defmodule RDF.Guards do
|
||||
@moduledoc """
|
||||
A collection of guards.
|
||||
"""
|
||||
|
||||
import RDF.Utils.Guards
|
||||
|
||||
@doc """
|
||||
Returns if the given value is an atom which could potentially be an `RDF.Vocabulary.Namespace` term.
|
||||
"""
|
||||
defguard maybe_ns_term(term) when maybe_module(term)
|
||||
|
||||
@doc """
|
||||
Returns if the given value is a triple, i.e. a tuple with three elements.
|
||||
"""
|
||||
defguard is_triple(t) when is_tuple(t) and tuple_size(t) == 3
|
||||
end
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
defmodule RDF.Utils.Guards do
|
||||
@moduledoc !"""
|
||||
A collection of guards intended for internal use.
|
||||
"""
|
||||
|
||||
defguard is_ordinary_atom(term)
|
||||
when is_atom(term) and term not in [nil, true, false]
|
||||
|
||||
|
|
Loading…
Reference in a new issue