Money.Sigil (Money v5.23.0)

View Source

Summary

Functions

sigil_M(amount, currency)

@spec sigil_M(binary(), [char()]) :: Money.t() | {:error, {module(), String.t()}}

Implements the sigil ~M for Money

The lower case ~m variant does not exist as interpolation and excape characters are not useful for Money sigils.

Example

iex> import Money.Sigil
iex> ~M[1000]usd
Money.new(:USD, "1000")
iex> ~M[1000.34]usd
Money.new(:USD, "1000.34")

validate_currency!(currency)