The tiny expression language used inside merge fields.
An expression is either a plain context lookup («=title») or a chain of
lookups separated by dots («=buyer.address.street»). As in the Ruby gem
the dot operator always performs a lookup rather than a function call, so
hashes, keyword lists and structs all behave the same way.
Summary
Functions
Evaluates an expression against a context.
Looks a single key up in value.
Parses an expression string.
Applies a conditional predicate such as present? or nil? to value.
Renders an expression the way sablon reports it in errors, e.g. «post.title».
Types
@type t() :: Sablon.Expression.Variable.t() | Sablon.Expression.LookupOrMethodCall.t()
Functions
Evaluates an expression against a context.
Looks a single key up in value.
Maps are searched by string key first and then by atom key, keyword lists by
atom key, and structs by field name. Lists answer size, length, count,
first, last and a numeric index; strings answer size and length.
Parses an expression string.
Applies a conditional predicate such as present? or nil? to value.
Unknown predicates fall back to a lookup, so a context value can expose its own flags.
Renders an expression the way sablon reports it in errors, e.g. «post.title».