defmodule Core.Author do @moduledoc """ Properties of the author, Sloane Modeled after the [h-card] specification. [h-card]: https://microformats.org/wiki/h-card """ use TypedStruct @public_properties ~w[name nickname url]a typedstruct do field :name, String.t() field :given_name, String.t() field :additional_name, String.t() field :family_name, String.t() field :nickname, String.t() field :email, String.t() field :url, String.t() end def sloane do %__MODULE__{ name: "Sloane Perrault", given_name: "Sloane", additional_name: "Loretta", family_name: "Perrault", nickname: "sloanely_but_surely", email: "sloane@fastmail.com", url: "https://sloanelybutsurely.com" } end def full do sloane() end def public do author = full() for key <- @public_properties, reduce: %__MODULE__{} do acc -> Map.put(acc, key, Map.get(author, key)) end end end