Module: Money::Constructors
- Included in:
- Money
- Defined in:
- lib/money/money/constructors.rb
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.
29 30 31 |
# File 'lib/money/money/constructors.rb', line 29 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.
12 13 14 |
# File 'lib/money/money/constructors.rb', line 12 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.
62 63 64 |
# File 'lib/money/money/constructors.rb', line 62 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.
78 79 80 |
# File 'lib/money/money/constructors.rb', line 78 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.
46 47 48 |
# File 'lib/money/money/constructors.rb', line 46 def us_dollar(cents) new(cents, "USD") end |