# File lib/money/bank/variable_exchange.rb, line 105 def exchange_with(from, to_currency, &block) to_currency = Currency.wrap(to_currency) if from.currency == to_currency from else if rate = get_rate(from.currency, to_currency) fractional = calculate_fractional(from, to_currency) from.class.new( exchange(fractional, rate, &block), to_currency ) else raise UnknownRate, "No conversion rate known for '#{from.currency.iso_code}' -> '#{to_currency}'" end end end