Module: Money::Constructors
- Included in:
- Money
- Defined in:
- lib/money/money/constructors.rb,
sig/lib/money/money/constructors.rbs
Instance Method Summary collapse
-
#ca_dollar(cents) ⇒ Money
(also: #cad)
Creates a new Money object of the given value, using the Canadian dollar currency.
-
#empty(currency = default_currency) ⇒ Money
(also: #zero)
Create a new money object with value 0.
-
#euro(cents) ⇒ Money
(also: #eur)
Creates a new Money object of the given value, using the Euro currency.
-
#pound_sterling(pence) ⇒ Money
(also: #gbp)
Creates a new Money object of the given value, in British pounds.
-
#us_dollar(cents) ⇒ Money
(also: #usd)
Creates a new Money object of the given value, using the American dollar currency.
Instance Method Details
#ca_dollar(cents) ⇒ Money Also known as: cad
Creates a new Money object of the given value, using the Canadian dollar currency.
30 31 32 |
# File 'lib/money/money/constructors.rb', line 30 def ca_dollar(cents) new(cents, "CAD") end |
#empty(currency = default_currency) ⇒ Money Also known as: zero
Create a new money object with value 0.
13 14 15 |
# File 'lib/money/money/constructors.rb', line 13 def empty(currency = default_currency) new(0, currency) end |
#euro(cents) ⇒ Money Also known as: eur
Creates a new Money object of the given value, using the Euro currency.
63 64 65 |
# File 'lib/money/money/constructors.rb', line 63 def euro(cents) new(cents, "EUR") end |
#pound_sterling(pence) ⇒ Money Also known as: gbp
Creates a new Money object of the given value, in British pounds.
79 80 81 |
# File 'lib/money/money/constructors.rb', line 79 def pound_sterling(pence) new(pence, "GBP") end |
#us_dollar(cents) ⇒ Money Also known as: usd
Creates a new Money object of the given value, using the American dollar currency.
47 48 49 |
# File 'lib/money/money/constructors.rb', line 47 def us_dollar(cents) new(cents, "USD") end |