Class: Van::Units::Converter::ExchangeRate::XMethods

Inherits:
Van::Units::Converter::ExchangeRate show all
Defined in:
lib/van/units/currency.rb

Overview

Exchange rate retrieval service that uses a service from www.xmethods.com. See rubyurl.com/7uq.

Instance Method Summary collapse

Methods inherited from Van::Units::Converter::ExchangeRate

#*, #**, #+, #-, #/, #coerce, create_conversion, #initialize, #value

Constructor Details

This class inherits a constructor from Van::Units::Converter::ExchangeRate

Instance Method Details

#get_rateObject

This is the only method that a subclass of ExchangeRate needs to implement. This is a good example to follow.



96
97
98
99
100
101
102
# File 'lib/van/units/currency.rb', line 96

def get_rate
  driver.getRate(country_mapping[@curr], country_mapping[base])
rescue
  p $!
  puts $!.backtrace
  nil
end