First pass at uniformed types, specs and docs

- spec public functions (skipping controllers, views, live views and
components)
- use types instead of explanations in docs
- remove redundant docs
- fix typos
This commit is contained in:
Claudio Ortolina
2026-03-06 08:33:11 +00:00
parent 99e30d5fdf
commit 7cf9b4e7f8
81 changed files with 652 additions and 300 deletions
+3
View File
@@ -9,13 +9,16 @@ defmodule MusicLibrary.Assets.Image do
@default_size 2000
@default_format "image/jpeg"
@spec fallback_data() :: binary()
def fallback_data, do: unquote(fallback_data)
@spec resize(binary(), pos_integer(), String.t()) :: {:ok, binary()} | {:error, term()}
def resize(cover_data, size \\ @default_size, format \\ @default_format) do
{:ok, thumb} = Operation.thumbnail_buffer(cover_data, size)
Image.write_to_buffer(thumb, extension(format))
end
@spec convert(binary(), String.t(), String.t()) :: {:ok, binary()}
def convert(cover_data, data_format, target_format) do
if data_format == target_format do
{:ok, cover_data}