Class: YDIM::CurrencyConverter

Inherits:
MobileCurrencyConverter show all
Includes:
ODBA::Persistable
Defined in:
lib/ydim/odba.rb,
lib/ydim/currency_converter.rb

Constant Summary collapse

ODBA_SERIALIZABLE =
['@conversions']

Instance Method Summary collapse

Methods inherited from MobileCurrencyConverter

#convert, #initialize

Constructor Details

This class inherits a constructor from YDIM::MobileCurrencyConverter

Instance Method Details

#drb_dupObject



17
18
19
# File 'lib/ydim/currency_converter.rb', line 17

def drb_dup
	MobileCurrencyConverter.new(@conversions)
end

#known_currenciesObject



20
21
22
# File 'lib/ydim/currency_converter.rb', line 20

def known_currencies
	@conversions.keys.collect { |origin, target| origin }.uniq.size
end

#store(origin, target, rate) ⇒ Object



23
24
25
26
# File 'lib/ydim/currency_converter.rb', line 23

def store(origin, target, rate)
	@conversions.store([target, origin], 1.0/rate)
	@conversions.store([origin, target], rate)
end