aegis v0.2.0 Aegis.DefaultPolicyFinder View Source
Base policy-finding module.
Finds policy module for corresponding data structure. Policies are found via the following naming convention:
The policy for a given resource should be named by appending “Policy” to the module name of the resource.
E.g.) for resource X
, the corresponding policy would be defined as
X.Policy
Link to this section Summary
Functions
Finds the policy module based off of the data structure of the provided
argument. If a corresponding policy is not found, :error
is returned
Link to this section Functions
Finds the policy module based off of the data structure of the provided
argument. If a corresponding policy is not found, :error
is returned.
Examples:
when Puppy.Policy is defined
iex> Aegis.PolicyFinder.call(Puppy)
iex> Aegis.PolicyFinder.call(%Puppy{})
when a policy is not defined for a structure
iex> Aegis.PolicyFinder.call(Kitten)
iex> Aegis.PolicyFinder.call(%Kitten{})
iex> Aegis.PolicyFinder.call(nil)