module

Money::Constructors

Instance methods

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")
Source
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")
Source
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.

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.

Source
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")
Source
zero(currency = default_currency, bank = nil) : Money

Creates a new Money object with value 0.

Money.zero       # => Money(@amount=0)
Money.zero(:pln) # => Money(@amount=0 @currency="PLN")
Source