changed hex_metadata.config
 
@@ -76,4 +76,4 @@
76
76
{<<"optional">>,false},
77
77
{<<"repository">>,<<"hexpm">>},
78
78
{<<"requirement">>,<<"~> 2.0">>}]]}.
79
- {<<"version">>,<<"1.2.0">>}.
79
+ {<<"version">>,<<"1.2.1">>}.
changed lib/straw_hat_map/world/continents/continents.ex
 
@@ -3,6 +3,7 @@ defmodule StrawHat.Map.Continents do
3
3
Defines functionality for continents.
4
4
"""
5
5
6
+ use StrawHat.Map.Interactor
6
7
alias StrawHat.Map.Continent
7
8
8
9
@continents [
 
@@ -30,4 +31,26 @@ defmodule StrawHat.Map.Continents do
30
31
@since "1.0.0"
31
32
@spec get_continents :: [Continent.t()]
32
33
def get_continents, do: @continents
34
+
35
+ @doc """
36
+ Finds a continent.
37
+ """
38
+ @since "1.2.1"
39
+ @spec find_continent(String.t()) :: {:ok, Continent.t()} | {:error, Error.t()}
40
+ def find_continent(continent_code) do
41
+ continent_code
42
+ |> get_continent()
43
+ |> Response.from_value(
44
+ Error.new("straw_hat_map.continent.not_found", metadata: [continent_code: continent_code])
45
+ )
46
+ end
47
+
48
+ @doc """
49
+ Gets a continent.
50
+ """
51
+ @since "1.2.1"
52
+ @spec get_continent(String.t()) :: Continent.t() | nil
53
+ def get_continent(continent_code) do
54
+ get_continents() |> Enum.find(fn continent -> continent.code == continent_code end)
55
+ end
33
56
end
changed mix.exs
 
@@ -2,7 +2,7 @@ defmodule StrawHat.Map.Mixfile do
2
2
use Mix.Project
3
3
4
4
@name :straw_hat_map
5
- @version "1.2.0"
5
+ @version "1.2.1"
6
6
@elixir_version "~> 1.6"
7
7
8
8
@description """