Fab.Person behaviour (fab_person v1.0.0)

Functions for generating random information about a person.

Supported Locales

  • af_ZA
  • az
  • cs_CZ
  • da
  • de
  • de_AT
  • de_CH
  • dv
  • el
  • en
  • en_AU
  • en_GB
  • en_GH
  • en_HK
  • en_IN
  • en_NG
  • en_ZA
  • es
  • fr
  • ja
  • pt_BR
  • pt_PT
  • ru
  • zh_CN

Summary

Functions

Returns a random first name.

Generates a random full name.

Returns a random last name.

Returns a random middle name.

Returns a random name prefix.

Returns a random sex.

Returns a random name suffix.

Types

sex_t()

@type sex_t() :: {:sex, :female | :male | :mixed}

Callbacks

first_name(list)

(optional)
@callback first_name([sex_t()]) :: [String.t()]

full_name()

(optional)
@callback full_name() :: [String.t()]

last_name(list)

(optional)
@callback last_name([sex_t()]) :: [String.t()]

middle_name(list)

(optional)
@callback middle_name([sex_t()]) :: [String.t()]

prefix(list)

(optional)
@callback prefix([sex_t()]) :: [String.t()]

sex()

(optional)
@callback sex() :: [String.t()]

suffix()

(optional)
@callback suffix() :: [String.t()]

Functions

first_name(opts \\ [])

@spec first_name([sex_t()]) :: String.t()

Returns a random first name.

Options

  • :sex – Can be :female, :male, or :mixed. Defaults to :mixed.

Examples

iex> Fab.Person.first_name()
"Ciara"

iex> Fab.Person.first_name(sex: :female)
"Cheryl"

iex> Fab.Person.first_name(sex: :male)
"Erik"

full_name(opts \\ [])

@spec full_name([sex_t()]) :: String.t()

Generates a random full name.

Options

  • :first_name - First name to use. Defaults to a randomly selected name based on :sex.
  • :last_name - Last name to use. Defaults to a randomly selected name based on :sex.
  • :middle_name - Middle name to use. Defaults to a randomly selected name based on :sex.
  • :prefix - Prefix to use. Defaults to a randomly selected prefix based on :sex.
  • :sex - Sex used to generate the first and last name. Can be :female, :male or :mixed. Defaults to :mixed.
  • :suffix - Suffix to use. Defaults to a randomly selected suffix based on :sex.

Examples

iex> Fab.Person.full_name()
"Osbaldo Reilly"

iex> Fab.Person.full_name(first_name: "Anthony")
"Anthony Schuppe"

iex> Fab.Person.full_name(last_name: "Smith")
"Miss Orville Smith"

iex> Fab.Person.full_name(sex: :female)
"Dr. Amy Romaguera"

iex> Fab.Person.full_name(sex: :male)
"Mr. Bryan Reichert"

last_name(opts \\ [])

@spec last_name([sex_t()]) :: String.t()

Returns a random last name.

Options

  • :sex – Can be :female, :male, or :mixed. Defaults to :mixed.

Examples

iex> Fab.Person.last_name()
"Reinger"

iex> Fab.Person.last_name(sex: :female)
"Lehner"

iex> Fab.Person.last_name(sex: :male)
"Glover"

middle_name(opts \\ [])

@spec middle_name([sex_t()]) :: String.t()

Returns a random middle name.

Options

  • :sex – Can be :female, :male, or :mixed. Defaults to :mixed.

Examples

iex> Fab.Person.middle_name()
"Jules"

iex> Fab.Person.middle_name(sex: :female)
"Ellen"

iex> Fab.Person.middle_name(sex: :male)
"William"

prefix(opts \\ [])

@spec prefix([sex_t()]) :: String.t()

Returns a random name prefix.

Options

  • :sex – Can be :female, :male, or :mixed. Defaults to :mixed.

Examples

iex> Fab.Person.prefix()
"Mr."

iex> Fab.Person.prefix(sex: :female)
"Dr."

iex> Fab.Person.prefix(sex: :male)
"Mr."

sex()

@spec sex() :: String.t()

Returns a random sex.

Examples

iex> Fab.Person.sex()
"male"

suffix()

@spec suffix() :: String.t()

Returns a random name suffix.

Examples

iex> Fab.Person.suffix()
"DVM"