Module Money::Constructors
In: lib/money/money/constructors.rb

Methods

ca_dollar   cad   empty   eur   euro   gbp   pound_sterling   us_dollar   usd   zero  

Public Instance methods

Creates a new Money object of the given value, using the Canadian dollar currency.

@param [Integer] cents The cents value.

@return [Money]

@example

  n = Money.ca_dollar(100)
  n.cents    #=> 100
  n.currency #=> #<Money::Currency id: cad>
cad(cents)

Alias for ca_dollar

Create a new money object with value 0.

@param [Currency, String, Symbol] currency The currency to use.

@return [Money]

@example

  Money.empty #=> #<Money @fractional=0>
eur(cents)

Alias for euro

Creates a new Money object of the given value, using the Euro currency.

@param [Integer] cents The cents value.

@return [Money]

@example

  n = Money.euro(100)
  n.cents    #=> 100
  n.currency #=> #<Money::Currency id: eur>
gbp(pence)

Alias for pound_sterling

Creates a new Money object of the given value, in British pounds.

@param [Integer] pence The pence value.

@return [Money]

@example

  n = Money.pound_sterling(100)
  n.fractional    #=> 100
  n.currency #=> #<Money::Currency id: gbp>

Creates a new Money object of the given value, using the American dollar currency.

@param [Integer] cents The cents value.

@return [Money]

@example

  n = Money.us_dollar(100)
  n.cents    #=> 100
  n.currency #=> #<Money::Currency id: usd>
usd(cents)

Alias for us_dollar

zero(currency = default_currency)

Alias for empty

[Validate]