class Money::Currency::Exchange

Direct Known Subclasses

Defined in:

money/currency/exchange.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(rate_store : Money::Currency::RateStore | Nil = nil, rate_provider : Money::Currency::RateProvider | Nil = nil) #

[View source]

Instance Method Detail

def base_currencies : Array(Currency) #

Returns an array of supported (registered) base currencies.


[View source]
def exchange(from : Money, to : Currency) : Money #

Exchanges the given Money object to a new Money object in to Currency.


[View source]
def exchange_rate(base : Currency, target : Currency) : BigDecimal #

Returns the exchange rate between base and target currency, or raises UnknownRateError if not found.


[View source]
def exchange_rate?(base : Currency, target : Currency) : BigDecimal | Nil #

Returns the exchange rate between base and target currency, or nil if not found.


[View source]
def rate_provider : RateProvider #

An exchange RateProvider object, used to fetch exchange rate pairs.

NOTE Will return Money.default_rate_provider if set to nil (the default).


[View source]
def rate_provider=(rate_provider : RateProvider | Nil) #

An exchange RateProvider object, used to fetch exchange rate pairs.

NOTE Will return Money.default_rate_provider if set to nil (the default).


[View source]
def rate_store : RateStore #

An exchange RateStore object, used to persist exchange rate pairs.

NOTE Will return Money.default_rate_store if set to nil (the default).


[View source]
def rate_store=(rate_store : RateStore | Nil) #

An exchange RateStore object, used to persist exchange rate pairs.

NOTE Will return Money.default_rate_store if set to nil (the default).


[View source]
def target_currencies : Array(Currency) #

Returns an array of supported (registered) target currencies.


[View source]