Readmix.Scope behaviour (readmix v0.6.2)

Defines the scope behaviour for Readmix scopes.

A scope is used to define variables used in Readmix blocks, such as:

<!-- rdmx :app_dep vsn:$my_custom_variable -->
some content
<!-- rdmx /:app_dep -->

To define $my_custom_variable, a scope module could be defined like so:

defmodule MyScope do
  @behaviour Readmix.Env

  @impl true
  def get_vars do
    %{my_custom_variable: "1.2.3"}
  end
end

Scopes can be provided with the :scopes options for Readmix.new/1.

Summary

Types

vars()

@type vars() :: %{optional(atom()) => term()}

Callbacks

get_vars()

@callback get_vars() :: vars()