GitHooks.Tasks.MFA (git_hooks v0.6.4) View Source

Represents a {module, function, arity} (a.k.a. mfa) that will be evaluated by the Kernel module.

An mfa should be configured as {module, function, arity}. The function of the module will always receive the hook arguments and the arity is expected to match the same number to avoid any unexpected behaviour.

See Elixir documentation for more information.

For example:

config :git_hooks,
  hooks: [
    pre_commit: [
      {MyModule, :my_function, 1}
    ]
  ]

Link to this section Summary

Types

t()

Represents an mfa to be executed.

Link to this section Types

Specs

t() :: %GitHooks.Tasks.MFA{
  args: [any()],
  function: atom(),
  module: atom(),
  result: term()
}

Represents an mfa to be executed.

Link to this section Functions

Link to this function

new(arg, git_hook_type, git_hook_args)

View Source

Specs

new(mfa(), GitHooks.git_hook_type(), GitHooks.git_hook_args()) :: t()

Creates a new mfa struct.

Examples

iex> Elixir.GitHooks.Tasks.MFA.new({MyModule, :my_function, 1}, :pre_commit, ["commit message"])
%Elixir.GitHooks.Tasks.MFA{module: MyModule, function: :my_function, args: ["commit message"]}