Skip to content

Instantly share code, notes, and snippets.

@nallwhy
Last active August 21, 2022 14:36
Show Gist options
  • Save nallwhy/3858c75f89b5266ad3239d14213f09a5 to your computer and use it in GitHub Desktop.
Save nallwhy/3858c75f89b5266ad3239d14213f09a5 to your computer and use it in GitHub Desktop.
Definject with no do case
defmodule DefinjectPlayground do
import Definject
# definject hello(who, opts \\ [])
# definject hello(name_list, _opts) when is_list(name_list), do: name_list |> Enum.map(& "Hello, #{&1}")
# definject hello(name, _opts) when is_binary(name), do: "Hello, #{name}"
def hello(who, opts \\ [])
def hello(name_list, _opts) when is_list(name_list), do: name_list |> Enum.map(& "Hello, #{&1}")
def hello(name, _opts) when is_binary(name), do: "Hello, #{name}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment