class Money
Constants
- EXCHANGE_RATES
Attributes
amount[R]
currency[R]
Public Class Methods
new(amount, currency = "USD")
click to toggle source
# File activerecord/test/models/customer.rb, line 36 def initialize(amount, currency = "USD") @amount, @currency = amount, currency end
Public Instance Methods
exchange_to(other_currency)
click to toggle source
# File activerecord/test/models/customer.rb, line 40 def exchange_to(other_currency) Money.new((amount * EXCHANGE_RATES["#{currency}_TO_#{other_currency}"]).floor, other_currency) end