Module: Exchange

Defined in:
lib/exchange/money.rb,
lib/exchange/iso.rb,
lib/exchange/base.rb,
lib/exchange/helper.rb,
lib/exchange/gem_loader.rb,
lib/exchange/cache/base.rb,
lib/exchange/cache/file.rb,
lib/exchange/cache/redis.rb,
lib/exchange/cache/rails.rb,
lib/exchange/typecasting.rb,
lib/exchange/configurable.rb,
lib/exchange/cache/memory.rb,
lib/exchange/configuration.rb,
lib/exchange/cache/no_cache.rb,
lib/exchange/cache/memcached.rb,
lib/exchange/external_api/ecb.rb,
lib/exchange/external_api/xml.rb,
lib/exchange/external_api/call.rb,
lib/exchange/external_api/base.rb,
lib/exchange/external_api/json.rb,
lib/exchange/cache/configuration.rb,
lib/exchange/external_api/random.rb,
lib/exchange/core_extensions/cachify.rb,
lib/exchange/external_api/xavier_media.rb,
lib/exchange/external_api/configuration.rb,
lib/exchange/core_extensions/float/error_safe.rb,
lib/exchange/external_api/open_exchange_rates.rb,
lib/exchange/core_extensions/numeric/conversability.rb

Overview

Top Level Module of the the gem.

Author:

Since:

Version:

Defined Under Namespace

Modules: Cache, Cachify, Conversability, Decachify, ErrorSafe, ExternalAPI, Typecasting Classes: Configurable, Configuration, GemLoader, Helper, ISO, Money

Constant Summary

VERSION =

The current version of the exchange gem

'1.0.4'
ROOT_PATH =

The root installation path of the gem

Since:

  • 0.1

Version:

  • 0.5

File.dirname(__FILE__).to_s.sub(/\/lib\/exchange\/?$/, '')
NoRateError =

The error that gets thrown if no conversion rate is available

Since:

  • 0.1

Version:

  • 0.1

Class.new StandardError
NoCurrencyError =

The error that gets thrown if the given currency is not a currency

Since:

  • 0.10

Version:

  • 0.10

Class.new ArgumentError
ImplicitConversionError =

The error that will get thrown when implicit conversions take place and are not allowed

Since:

  • 0.1

Class.new StandardError

Class Method Summary (collapse)

Class Method Details

+ (Exchange::Configuration) configuration

A getter for the configuration, returns the currently installed configuration or a default configuration if no configuration is installed

Returns:

Since:

  • 0.1



23
24
25
# File 'lib/exchange/configuration.rb', line 23

def configuration
  @configuration ||= Configuration.new
end

+ (Exchange::Configuration) configuration=(configuration)

A configuration setter for the Exchange gem. This comes in handy if you want to have backup or test setting

Parameters:

Returns:

Raises:

  • (ArgumentError)

    if fed with anything else than an Exchange::Configuration

Since:

  • 0.1



11
12
13
14
15
16
17
# File 'lib/exchange/configuration.rb', line 11

def configuration= configuration
  if configuration.is_a? Exchange::Configuration
    @configuration = configuration
  else
    raise ArgumentError.new("The configuration needs to be an instance of Exchange::Configuration")
  end
end