”Use“ and some metaprograming to refactor behaviours implimentation
This commit is contained in:
@@ -3,23 +3,15 @@ defmodule IbanEx.Country.FR do
|
||||
France IBAN parsing rules
|
||||
"""
|
||||
|
||||
alias IbanEx.Iban
|
||||
|
||||
@behaviour IbanEx.Country.Template
|
||||
|
||||
@size 27
|
||||
|
||||
@rule ~r/^(?<bank_code>[0-9]{5})(?<branch_code>[0-9]{5})(?<account_number>[0-9A-Z]{11})(?<national_check>[0-9]{2})$/i
|
||||
|
||||
@spec size() :: 27
|
||||
def size(), do: @size
|
||||
use IbanEx.Country.Template
|
||||
|
||||
@spec rule() :: Regex.t()
|
||||
def rule(), do: @rule
|
||||
|
||||
@spec to_s(Iban.t()) :: binary()
|
||||
@spec to_s(Iban.t(), binary()) :: binary()
|
||||
def to_s(
|
||||
@impl IbanEx.Country.Template
|
||||
@spec to_string(Iban.t()) :: binary()
|
||||
@spec to_string(Iban.t(), binary()) :: binary()
|
||||
def to_string(
|
||||
%Iban{
|
||||
country_code: country_code,
|
||||
check_digits: check_digits,
|
||||
|
||||
Reference in New Issue
Block a user