Improve type specifications and documentation

- Added missing type specifications for Hello function and rules - Updated documentation for the Deserialize protocol -
Cleaned up IBAN validation function documentation - Enhanced test fixture generation with clearer parsing and error
messages
This commit is contained in:
2025-12-02 11:14:40 -05:00
parent 71aa8cfde6
commit 492cb2378e
9 changed files with 41 additions and 43 deletions

View File

@@ -1,4 +1,10 @@
defprotocol IbanEx.Deserialize do
@moduledoc """
Protocol for converting various data types into IBAN structs.
Implementations exist for String, Map, and List types.
"""
@type iban() :: IbanEx.Iban.t()
@type iban_or_error() ::
iban()
@@ -15,13 +21,8 @@ def to_iban(value)
defimpl IbanEx.Deserialize, for: [BitString, String] do
alias IbanEx.{Parser, Error}
@type iban() :: IbanEx.Iban.t()
@type iban_or_error() ::
iban()
| {:invalid_checksum, binary()}
| {:invalid_format, binary()}
| {:invalid_length, binary()}
| {:can_not_parse_map, binary()}
| {:unsupported_country_code, binary()}
@type iban_or_error() :: iban() | {atom(), binary()}
def to_iban(string) do
case Parser.parse(string) do
{:ok, iban} -> iban