module

Noir::JSOptionGate

How a helper's refusal depends on what its caller passes. umami's parseRequest(request, schema, options?) refuses under if (!options?.skipAuth && !error); whether a given call is refused depends on that call's third argument. Every if still open around the refusal is read for references to the helper's own parameters, and each reference becomes a Gate: the refusal runs only when that argument (or its key) has the value runs_when. A local (!error) is not a parameter and is not read.

Constants

ENTRY = /\A(?:\.\.\.)?([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?(?:\s*=\s*([\s\S]+))?\z/
FALSY = Set {"false", "null", "undefined", "0", "''", "\"\""}
IDENT = /\A[A-Za-z_$][\w$]*\z/
REQUEST_PARAM = /\A(?:req|request|res|response|ctx|context|event|headers)\z/

The request and its peers: a branch on them depends on the caller, not on an option the route chose.

Instance methods

gates(conditions : Array(String), params : Array(Param)) : Array(Gate)

The gates the if conditions conditions put on a refusal.

Source
outcome(gates : Array(Gate), args : Array(String), lookup : Proc(String, String | Nil)) : Symbol

:skipped when the call's args turn the refusal off, :unknown when a value it depends on is not a literal ({ skipAuth: isPublic }), :runs otherwise. lookup gives a const's initializer in the caller. An option in an || cannot turn the refusal off by itself (!options?.skipAuth || !isPublicSchema(schema)): that is :unknown. ponytail: an || is not evaluated, so !skipAuth || forceAuth called with both literal is still :unknown; evaluate it if a route needs that.

Source
params(list : String) : Array(Param)

The parameters of list, the text between a function's parentheses.

Source

Nested types