Cantrip.Circle (Cantrip v1.3.3)

Copy Markdown View Source

Your circle is the bounded place the entity is summoned into. It declares the medium you think in, the gates you can call, and the wards that constrain your loop; Cantrip.new/1 validates that exactly one medium is declared.

Runtime boundary for a cantrip entity.

A circle declares the medium the entity thinks in, the gates it can call, and the wards that constrain the loop. Cantrip.new/1 validates that callers declare exactly one medium using :type, :medium, or :circle_type.

Summary

Functions

Validate medium declaration. Returns :ok or {:error, reason}. Called during Cantrip construction.

Types

gate()

@type gate() :: %{:name => String.t(), optional(:parameters) => map()}

t()

@type t() :: %Cantrip.Circle{
  gates: %{required(String.t()) => map()},
  medium_opts: map(),
  medium_sources: term(),
  schema_version: pos_integer(),
  type: atom(),
  wards: [map()]
}

Functions

has_done?(circle)

@spec has_done?(t()) :: boolean()

new(attrs \\ %{})

@spec new(keyword() | map()) :: t()

validate_medium(circle)

@spec validate_medium(t()) :: :ok | {:error, String.t()}

Validate medium declaration. Returns :ok or {:error, reason}. Called during Cantrip construction.

Omitting a medium declaration is an error. Conflicting medium declarations are also an error.