Brex v0.2.3 Brex.Operator View Source

A struct which represents a rule linking two or more other rules together. It does this by accepting a list of clauses and an aggregator, being an arity 1 function which reduces a list of booleans into a single boolean.

Custom Operators

Creating a custom operator is merely a case of wrapping your rules into the Brex.Operator struct and providing your custom aggregator alongside.

Example

%Brex.Operator{
  rules: [my_rule1, my_rule2],
  aggregator: my_aggregation_function # For example &Enum.all?/1
}

Link to this section Summary

Link to this section Types

Link to this type aggregator() View Source
aggregator() :: ([boolean()] -> boolean())
Link to this type t() View Source
t() :: %Brex.Operator{aggregator: aggregator(), clauses: clauses()}

Link to this section Functions