Cadastre.Country (Cadastre v0.2.14) View Source
Country implementation.
Link to this section Summary
Functions
Returns all countries.
Returns all ids (ISO_3166-1).
Returns country name translation for locale
Returns %Cadastre.Country{}
for valid id
or nil
for invalid id
.
Link to this section Types
Specs
id() :: <<_::16>>
Specs
t() :: %Cadastre.Country{id: id()}
Link to this section Functions
Specs
all() :: [t()]
Returns all countries.
Examples
iex> Cadastre.Country.all() |> Enum.take(3)
[
%Cadastre.Country{id: "AD"},
%Cadastre.Country{id: "AE"},
%Cadastre.Country{id: "AF"}
]
iex> Cadastre.Country.all() |> Enum.count()
250
Specs
ids() :: [id()]
Returns all ids (ISO_3166-1).
Examples
iex> Cadastre.Country.ids() |> Enum.take(10)
["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR"]
Specs
name(t(), Cadastre.Language.id()) :: String.t()
Returns country name translation for locale
Examples
iex> Cadastre.Country.new("NL") |> Cadastre.Country.name("be")
"Нідэрланды"
iex> Cadastre.Country.new("NL") |> Cadastre.Country.name(":)")
"Netherlands"
iex> Cadastre.Country.name("something wrong", "be")
nil
Specs
Returns %Cadastre.Country{}
for valid id
or nil
for invalid id
.
Examples
iex> Cadastre.Country.new("NL")
%Cadastre.Country{id: "NL"}
iex> Cadastre.Country.new("nl")
%Cadastre.Country{id: "NL"}
iex> Cadastre.Country.new("xx")
nil