Method: Money.new_with_amount
- Defined in:
- lib/money/money.rb
.new_with_amount(amount, currency = Money.default_currency, bank = Money.default_bank) ⇒ Money
Creates a new Money object of amount
value , with given currency
.
The amount value is expressed in the main monetary unit, opposite to the subunit-based representation used internally by this library called cents
.
189 190 191 192 193 194 |
# File 'lib/money/money.rb', line 189 def self.new_with_amount(amount, currency = Money.default_currency, bank = Money.default_bank) money = from_numeric(amount, currency) # Hack! You can't change a bank money.instance_variable_set("@bank", bank) money end |