module Money::Constructors
Defined in:
money/money/constructors.crInstance Method Summary
-
#bitcoin(cents, bank = nil)
Creates a new
Money
object of the given value, using the Bitcoin cryptocurrency. -
#euro(cents, bank = nil)
Creates a new
Money
object of the given value, using the Euro currency. -
#from_amount(amount : Number | String, currency = default_currency, bank = nil) : Money
Creates a new
Money
object of value given in the unit of the given currency. -
#us_dollar(cents, bank = nil)
Creates a new
Money
object of the given value, using the American dollar currency. -
#zero(currency = default_currency, bank = nil) : Money
Creates a new
Money
object with value0
.
Instance Method Detail
def bitcoin(cents, bank = nil)
#
Creates a new Money
object of the given value, using the
Bitcoin cryptocurrency.
Money.bitcoin(100) # => Money(@amount=0.000001 @currency="BTC")
def euro(cents, bank = nil)
#
Creates a new Money
object of the given value, using the
Euro currency.
Money.euro(100) # => Money(@amount=1 @currency="EUR")
Creates a new Money
object of value given in the unit of the given
currency.
Money.from_amount(23.45, "USD") # => Money(@amount=23.45 @currency="USD")
Money.from_amount(23.45, "JPY") # => Money(@amount=23 @currency="JPY")
See #initialize
.
def us_dollar(cents, bank = nil)
#
Creates a new Money
object of the given value, using the
American dollar currency.
Money.us_dollar(100) # => Money(@amount=1 @currency="USD")
Creates a new Money
object with value 0
.
Money.zero # => Money(@amount=0)
Money.zero(:pln) # => Money(@amount=0 @currency="PLN")