This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyProject.User do | |
defstruct [:first, :last, :role] | |
def is_admin?(%__MODULE__{role: "admin"}), do: true | |
def is_admin?(_user), do: false | |
def full_name(user, _opts \\ []) when not is_nil(user) do | |
build_full_name(user) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyAppWeb.EmailPreviewController do | |
use MyAppWeb, :controller | |
plug(:put_layout, false) | |
def index(conn, _) do | |
emails = | |
:functions | |
|> Emails.__info__() | |
|> Keyword.keys() |