Module.defines-question-mark

You're seeing just the function defines-question-mark, go back to Module module for more information.

Specs

defines?(module(), definition()) :: boolean()

Checks if the module defines the given function or macro.

Use defines?/3 to assert for a specific type.

This function can only be used on modules that have not yet been compiled. Use Kernel.function_exported?/3 and Kernel.macro_exported?/3 to check for public functions and macros respectively in compiled modules.

Note that defines? returns false for functions and macros that have been defined but then marked as overridable and no other implementation has been provided. You can check the overridable status by calling overridable?/2.

Examples

defmodule Example do
  Module.defines?(__MODULE__, {:version, 0}) #=> false
  def version, do: 1
  Module.defines?(__MODULE__, {:version, 0}) #=> true
end
Link to this function

defines?(module, tuple, def_kind)

View Source

Specs

defines?(module(), definition(), def_kind()) :: boolean()

Checks if the module defines a function or macro of the given kind.

kind can be any of :def, :defp, :defmacro, or :defmacrop.

This function can only be used on modules that have not yet been compiled. Use Kernel.function_exported?/3 and Kernel.macro_exported?/3 to check for public functions and macros respectively in compiled modules.

Examples

defmodule Example do
  Module.defines?(__MODULE__, {:version, 0}, :def) #=> false
  def version, do: 1
  Module.defines?(__MODULE__, {:version, 0}, :def) #=> true
end