Current section

Files

Jump to
humo lib humo resource_helpers.ex
Raw

lib/humo/resource_helpers.ex

defmodule Humo.ResourceHelpers do
defmacro __using__(_opts) do
quote do
@behaviour Humo.ResourceHelpers
@type action() :: String.t()
@doc """
Returns resource name.
"""
@spec name() :: String.t()
def name() do
raise "Method is not implemented."
end
@doc """
Returns list of actions
"""
@spec actions() :: nonempty_list(action())
def actions(), do: ["create", "read", "update", "delete"]
defoverridable name: 0, actions: 0
end
end
@type action() :: String.t()
@doc """
Returns resource name.
"""
@callback name() :: String.t()
@doc """
Returns list of actions
"""
@callback actions() :: nonempty_list(action())
end