Module: Currency::Exchange

Defined in:
lib/currency/exchange.rb

Overview

The Currency::Exchange package is responsible for the buying and selling of currencies.

This feature is currently unimplemented.

Exchange rate sources are configured via Currency::Exchange::Rate::Source.

Defined Under Namespace

Classes: Rate, TimeQuantitizer

Constant Summary collapse

@@default =
nil
@@current =
nil

Class Method Summary collapse

Class Method Details

.currentObject

Returns the current Currency::Exchange object used during explicit and implicit Money trading.

If #current= has not been called and #default= has not been called, then UndefinedExchange is raised.



34
35
36
# File 'lib/currency/exchange.rb', line 34

def self.current
  @@current || self.default || (raise ::Currency::Exception::UndefinedExchange.new("Currency::Exchange.current not defined"))
end

.current=(x) ⇒ Object

Sets the current Currency::Exchange object used during explicit and implicit Money conversions.



40
41
42
# File 'lib/currency/exchange.rb', line 40

def self.current=(x)
  @@current = x
end

.defaultObject

Returns the default Currency::Exchange object.

If one is not specfied an instance of Currency::Exchange::Base is created. Currency::Exchange::Base cannot service any conversion rate requests.



20
21
22
# File 'lib/currency/exchange.rb', line 20

def self.default 
  @@default ||= raise("UNIMPLEMENTED")
end

.default=(x) ⇒ Object

Sets the default Currency::Exchange object.



25
26
27
# File 'lib/currency/exchange.rb', line 25

def self.default=(x)
  @@default = x
end