module

Alumna

--- Solving a circular dependency --- RuleContext needs App and Service as types, but App/Service need Rule. Forward-declare them so context can compile.

Constants

VERSION = "0.5.9"

Class methods

cors(origins : Array(String) = ["*"], methods : Array(String) = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"] of ::String, headers : Array(String) = ["Content-Type", "Authorization", "Accept"] of ::String, credentials : Bool = false, max_age : Int32 = 86400) : Rule
Source
logger(io : IO = STDOUT) : Rule
Source
memory(schema : Schema | Nil = nil)

Overload without a block

Source
memory(schema : Schema | Nil = nil, &)

Overload with a block

Source
rate_limit(limit : Int32 = 100, window_seconds : Int32 = 60, key : Proc(RuleContext, String) = ->(ctx : RuleContext) do ctx.remote_ip end) : Rule
Source
timestamp(*fields : String) : Rule

Injects the current UTC timestamp into the specified fields of ctx.data. Designed to be used with explicit method scopes (e.g., on: :create or on: :write).

Source
to_any(v : Int8 | Int16 | Int32 | UInt8 | UInt16 | UInt32 | UInt64) : AnyData

DX Helper: Auto-cast common types to their AnyData equivalents

Source
to_any(v : Float32) : AnyData
Source
to_any(v : AnyData) : AnyData
Source
validate(schema : Schema) : Rule
Source

Macros

hash

Helper macro to cleanly instantiate a Hash(String, AnyData) without the of String => AnyData generic friction.

Source

Nested types