Current section

Files

Jump to
ash_admin lib ash_admin components resource helpers format_helper.ex
Raw

lib/ash_admin/components/resource/helpers/format_helper.ex

defmodule AshAdmin.Components.Resource.Helpers.FormatHelper do
@moduledoc false
def format_attribute(formats, record, attribute) do
{mod, func, args} =
Keyword.get(formats || [], attribute.name, {Phoenix.HTML.Safe, :to_iodata, []})
record
|> Map.get(attribute.name)
|> then(&apply(mod, func, [&1] ++ args))
end
end