NLdoc.Validation.State (NLdoc.Validation v4.0.19)
View SourceState for validation rules.
Summary
Functions
Gets the given field from the state object.
Modifies a state object by setting the given field to the value that field had in the old state.
Prepends a list of values or a single value to the list field in the state object.
Sets the given field on the state object to the given value.
Types
@type t() :: %NLdoc.Validation.State{ definition_term_id_without_details: (String.t() | nil) | nil, encountered_heading_1?: boolean() | nil, findings: [NLdoc.Spec.Validation.Finding.t()] | nil, heading_level: (:infinity | integer()) | nil, parent_is_heading?: boolean() | nil }
Functions
@spec get(t(), :findings) :: [NLdoc.Spec.Validation.Finding.t()]
@spec get(t(), :heading_level) :: :infinity | integer()
@spec get(t(), :definition_term_id_without_details) :: String.t() | nil
@spec get(t(), :encountered_heading_1?) :: boolean()
@spec get(t(), :parent_is_heading?) :: boolean()
Gets the given field from the state object.
This function only accepts fields of the state, which are :findings, :heading_level, :definition_term_id_without_details, :encountered_heading_1?, :parent_is_heading?. It will raise if the field is not valid.
@spec keep(t(), t(), :findings) :: t()
@spec keep(t(), t(), :heading_level) :: t()
@spec keep(t(), t(), :definition_term_id_without_details) :: t()
@spec keep(t(), t(), :encountered_heading_1?) :: t()
@spec keep(t(), t(), :parent_is_heading?) :: t()
Modifies a state object by setting the given field to the value that field had in the old state.
This function only accepts fields of the state, which are :findings, :heading_level, :definition_term_id_without_details, :encountered_heading_1?, :parent_is_heading?. It will raise if the field is not valid.
@spec prepend(t(), :findings, [NLdoc.Spec.Validation.Finding.t()]) :: t()
@spec prepend(t(), :findings, NLdoc.Spec.Validation.Finding.t()) :: t()
Prepends a list of values or a single value to the list field in the state object.
This function only accepts fields of the state, which are :findings. It will raise if the field is not valid.
@spec set(t(), :findings, [NLdoc.Spec.Validation.Finding.t()]) :: t()
@spec set(t(), :heading_level, :infinity | integer()) :: t()
@spec set(t(), :definition_term_id_without_details, String.t() | nil) :: t()
@spec set(t(), :encountered_heading_1?, boolean()) :: t()
@spec set(t(), :parent_is_heading?, boolean()) :: t()
Sets the given field on the state object to the given value.
This function only accepts fields of the state, which are :findings, :heading_level, :definition_term_id_without_details, :encountered_heading_1?, :parent_is_heading?. It will raise if the field is not valid.