Record.extract

You're seeing just the function extract, go back to Record module for more information.

Specs

extract(name :: atom(), keyword()) :: keyword()

Extracts record information from an Erlang file.

Returns a quoted expression containing the fields as a list of tuples.

name, which is the name of the extracted record, is expected to be an atom at compile time.

Options

This function accepts the following options, which are exclusive to each other (i.e., only one of them can be used in the same call):

  • :from - (binary representing a path to a file) path to the Erlang file that contains the record definition to extract; with this option, this function uses the same path lookup used by the -include attribute used in Erlang modules.

  • :from_lib - (binary representing a path to a file) path to the Erlang file that contains the record definition to extract; with this option, this function uses the same path lookup used by the -include_lib attribute used in Erlang modules.

  • :includes - (a list of directories as binaries) if the record being extracted depends on relative includes, this option allows developers to specify the directory where those relative includes exist.

  • :macros - (keyword list of macro names and values) if the record being extracted depends on the values of macros, this option allows the value of those macros to be set.

These options are expected to be literals (including the binary values) at compile time.

Examples

iex> Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
[
  size: :undefined,
  type: :undefined,
  access: :undefined,
  atime: :undefined,
  mtime: :undefined,
  ctime: :undefined,
  mode: :undefined,
  links: :undefined,
  major_device: :undefined,
  minor_device: :undefined,
  inode: :undefined,
  uid: :undefined,
  gid: :undefined
]