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.



36
37
38
# File 'lib/currency/exchange.rb', line 36

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

.current=(x) ⇒ Object

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



42
43
44
# File 'lib/currency/exchange.rb', line 42

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.



22
23
24
# File 'lib/currency/exchange.rb', line 22

def self.default 
  @@default ||= raise :Currency::Exception::Unimplemented, :default
end

.default=(x) ⇒ Object

Sets the default Currency::Exchange object.



27
28
29
# File 'lib/currency/exchange.rb', line 27

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