Skip to content

Commit

Permalink
Cosmetics.
Browse files Browse the repository at this point in the history
  • Loading branch information
am-kantox committed Jan 11, 2018
1 parent ea6264f commit adbac8f
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/lib_lat_lon/behaviours/provider.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ defmodule LibLatLon.Provider do
Implementations known:
* [`LibLatLon.Providers.OpenStreetMap`]
* [`LibLatLon.Providers.GoogleMaps`]
* `LibLatLon.Providers.OpenStreetMap`
* `LibLatLon.Providers.GoogleMaps`
Contributions are _very welcome_.
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/lib_lat_lon/data/bounds.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule LibLatLon.Bounds do
"""

@typedoc """
The `Bouds` struct has two fields:
The `Bouds` struct has two fields (`from` and `to`).
* `from` denoting the _northeast_ boundary, and
* `to` denoting the _southwest_ boundary.
Expand Down
20 changes: 10 additions & 10 deletions lib/lib_lat_lon/data/coords.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ defmodule LibLatLon.Coords do
Main struct to be used as coordinates representation.
One might cast nearly everything to `LibLatLon.Coord` with
[`LibLatLon.Coord.borrow/1`] and/or [`LibLatLon.Coord.borrow/2`].
`LibLatLon.Coord.borrow/1` and/or `LibLatLon.Coord.borrow/2`.
This struct implements both [`String.Chars`] and [`Inspect`] protocols.
This struct implements both `String.Chars` and `Inspect` protocols.
The fancy string representation of any lat/lon pair might be get by
[`Kernel.to_string/1`]:
`Kernel.to_string/1`:
iex> to_string(LibLatLon.Coords.borrow(lat: 41.38, lon: 2.19))
"41°22´48.0˝N,2°11´24.0˝E"
Expand All @@ -22,7 +22,7 @@ defmodule LibLatLon.Coords do
@typedoc """
The type to store coordinates.
Mostly used fields are `lat` and `lon`, stored as [`Float.t`]. Also
Mostly used fields are `lat` and `lon`, stored as `Float.t`. Also
might contain `altitude` and `direction` to calculate the latitude
and langitude for the destination point (mostly used when dealing with
`EXIF` information from images.)
Expand Down Expand Up @@ -52,7 +52,7 @@ defmodule LibLatLon.Coords do
@doc """
Converts `{{degree, minute, second}, semisphere}` or
`{[degree, minute, second], semisphere}` representation into
[`LibLatLon.Coords`].
`LibLatLon.Coords`.
"""
@spec borrow(dms(), any()) :: number()
def borrow({d, m, s}, ss), do: borrow(d, m, s, ss)
Expand All @@ -62,7 +62,7 @@ defmodule LibLatLon.Coords do

@doc """
Converts `degree, minute, second, semisphere` representation into
[`LibLatLon.Coords`]. When the last parameter `semisphere` is not one of:
`LibLatLon.Coords`. When the last parameter `semisphere` is not one of:
`"S"` or `"W"` or `-1` or `:south` or `west`, it is implicitly
considered to be in `NE` semisphere.
"""
Expand All @@ -76,7 +76,7 @@ defmodule LibLatLon.Coords do
def borrow(d, m, s, _), do: do_borrow(d, m, s)

@doc """
Converts literally any input to [`LibLatLon.Coords`] instance.
Converts literally any input to `LibLatLon.Coords` instance.
## Examples
Expand Down Expand Up @@ -211,7 +211,7 @@ defmodule LibLatLon.Coords do
@doc """
Converts literally anything, provided as latitude _and_ longitude values
to two tuples `{{degree, minute, second}, semisphere}`. Barely used
from the outside the package, since [`LibLatLon.Coords.t`] is obviously
from the outside the package, since `LibLatLon.Coords.t` is obviously
better type to work with coordinates by all means.
## Examples
Expand All @@ -230,7 +230,7 @@ defmodule LibLatLon.Coords do
@doc """
Converts literally anything, provided as combined `latlon` value
to two tuples `{{degree, minute, second}, semisphere}`. Barely used
from the outside the package, since [`LibLatLon.Coords.t`] is obviously
from the outside the package, since `LibLatLon.Coords.t` is obviously
better type to work with coordinates by all means.
## Examples
Expand Down Expand Up @@ -296,7 +296,7 @@ defmodule LibLatLon.Coords do
def coordinate(whatever), do: {:ok, Coords.borrow(whatever)}

@doc """
Same as [`LibLatLon.Coords.coordinate/1`], but banged.
Same as `LibLatLon.Coords.coordinate/1`, but banged.
## Examples
Expand Down
10 changes: 5 additions & 5 deletions lib/lib_lat_lon/data/info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ defmodule LibLatLon.Info do
"""

@typedoc """
Main type to store geo point in unified form. See:
Main type to store geo point in unified form.
* [`LibLatLon.Bounds.t`] for `bounds` field
* [`LibLatLon.Coords.t`] for `coords` key
* `LibLatLon.Bounds.t` for `bounds` field
* `LibLatLon.Coords.t` for `coords` key
`address` is a string, representing the whole address in human-readable form.
Expand Down Expand Up @@ -93,14 +93,14 @@ defmodule LibLatLon.Info do
def from_map(list) when is_list(list), do: {:ok, from_map!(list)}

@doc """
The same as [`LibLatLon.Info.from_map/1`], but banged.
The same as `LibLatLon.Info.from_map/1`, but banged.
"""
def from_map!([]), do: []
def from_map!(%{} = input), do: with({:ok, result} <- from_map(input), do: result)
def from_map!([%{} = h | t]), do: [from_map!(h) | from_map!(t)]

@doc """
Formats the [`String.t`] representation of this struct according to
Formats the `String.t` representation of this struct according to
the format given.
Second parameter `format` might include `%{field}` inclusions
Expand Down
4 changes: 2 additions & 2 deletions lib/lib_lat_lon/providers/google_maps.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ defmodule LibLatLon.Providers.GoogleMaps do

@doc """
Implements a lookup for `GoogleMaps` provider. Returns either
`{:ok, %LibLatLon.Info{}}` or `{:error, reason} tuple.
`{:ok, %LibLatLon.Info{}}` or `{:error, reason}` tuple.
Used internally by [`LibLatLon.lookup/1`].
Used internally by `LibLatLon.lookup/1`.
"""
@spec lookup(LibLatLon.Coords.t() | String.t(), %{}) ::
{:ok, LibLatLon.Info.t()} | {:error, any()}
Expand Down
4 changes: 2 additions & 2 deletions lib/lib_lat_lon/providers/open_street_map.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ defmodule LibLatLon.Providers.OpenStreetMap do

@doc """
Implements a lookup for `OpenStreetMap` provider. Returns either
`{:ok, %LibLatLon.Info{}}` or `{:error, reason} tuple.
`{:ok, %LibLatLon.Info{}}` or `{:error, reason}` tuple.
Used internally by [`LibLatLon.lookup/1`].
Used internally by `LibLatLon.lookup/1`.
"""
@spec lookup(LibLatLon.Coords.t() | String.t(), %{}) ::
{:ok, LibLatLon.Info.t()} | {:error, any()}
Expand Down
17 changes: 16 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule LibLatLon.MixProject do

@app :lib_lat_lon
@app_name "LibLatLon"
@version "0.3.0"
@version "0.3.1"

def project do
[
Expand All @@ -14,6 +14,7 @@ defmodule LibLatLon.MixProject do
start_permanent: Mix.env() == :prod,
description: description(),
docs: docs(),
xref: [exclude: []],
package: package(),
deps: deps()
]
Expand Down Expand Up @@ -70,6 +71,20 @@ defmodule LibLatLon.MixProject do
source_url: "https://github.com/amotion-city/#{@app}",
extras: [
"stuff/pages/intro.md"
],
groups_for_modules: [
# LibLatLon,
# LibLatLon.Provider

"Data Representation": [
LibLatLon.Bounds,
LibLatLon.Coords,
LibLatLon.Info
],
Providers: [
LibLatLon.Providers.GoogleMaps,
LibLatLon.Providers.OpenStreetMap
]
]
]
end
Expand Down

0 comments on commit adbac8f

Please sign in to comment.