Skip to content

Commit

Permalink
format_email_address/2 can return a single address or a list (#585)
Browse files Browse the repository at this point in the history
`Formatter.format_email_address/2` can return an address or [list of addresses](https://github.com/thoughtbot/bamboo/blob/9e13937eb9a8f5d67c4c9c1d9009ae798f04d5c8/lib/bamboo/formatter.ex#L74). 

This commit updates the `@spec` for `format_email_address` to account for 
both single address and lists of addresses (via the [`Email.address_list()`](https://github.com/thoughtbot/bamboo/blob/4080bd67eb13347c57de50dc32fefaa473e6c423/lib/bamboo/email.ex#L75) type).
  • Loading branch information
nonrational authored Feb 23, 2021
1 parent 6636983 commit 4066794
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bamboo/formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ defprotocol Bamboo.Formatter do
"""

@doc ~S"""
Receives data and opts and returns a string or a two item tuple `{name, address}`
Receives data and opts and returns a string, a two item tuple `{name, address}`, or a list of either.
opts is a map with the key `:type` and a value of
`:from`, `:to`, `:cc` or `:bcc`. You can pattern match on this to customize
Expand All @@ -65,7 +65,7 @@ defprotocol Bamboo.Formatter do

@type opts :: %{optional(:type) => :from | :to | :cc | :bcc}

@spec format_email_address(any, opts) :: Bamboo.Email.address()
@spec format_email_address(any, opts) :: Bamboo.Email.address_list()
def format_email_address(data, opts)
end

Expand Down

0 comments on commit 4066794

Please sign in to comment.