Current section
Files
Jump to
Current section
Files
lib/telegex/plug/presets.ex
defmodule Telegex.Plug.Presets do
@moduledoc """
Preset Plug-based abstraction.
"""
defmacro __using__(opts) do
implement_preset(opts)
end
defp implement_preset(:handler) do
quote do
use Telegex.Plug.Presets.Handler
end
end
defp implement_preset(:preheater) do
quote do
use Telegex.Plug.Presets.Preheater
end
end
defp implement_preset([{:commander, command}]) do
quote do
use Telegex.Plug.Presets.Commander, unquote(command)
end
end
defp implement_preset([{:caller, [{:prefix, prefix}]}]) do
quote do
use Telegex.Plug.Presets.Caller, unquote(prefix)
end
end
end