Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Options struct in to_string!/2 too and document it #127

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/money.ex
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ defmodule Money do
* `money` is any valid `Money.t` type returned
by `Money.new/2`

* `options` is a keyword list of options
* `options` is a keyword list of options or a `%Cldr.Number.Format.Options{}` struct

## Returns

Expand Down Expand Up @@ -742,7 +742,7 @@ defmodule Money do
* `money` is any valid `Money.t` type returned
by `Money.new/2`

* `options` is a keyword list of options
* `options` is a keyword list of options or a `%Cldr.Number.Format.Options{}` struct

## Options

Expand All @@ -766,7 +766,8 @@ defmodule Money do
"1,234 US dollars"

"""
@spec to_string!(Money.t(), Keyword.t()) :: String.t() | no_return()
@spec to_string!(Money.t(), Keyword.t() | Cldr.Number.Format.Options.t()) ::
String.t() | no_return()

def to_string!(%Money{} = money, options \\ []) do
case to_string(money, options) do
Expand Down